Gentoo催化剂:TypeError:预期的str,字节或os.PathLike对象,未列出[关闭]

问题描述 投票:0回答:1

这是一个函数副本,占用我的Gentoo Linux机器上Catalyst(Gentoo LiveCD创建工具)使用的文件之一的241-257行:

def normpath(mypath):
    """Clean up a little more than os.path.normpath

    Namely:
     - Make sure leading // is turned into /.
     - Leave trailing slash intact.
    """
    TrailingSlash=False
    if mypath[-1] == "/":
        TrailingSlash=True
    newpath = os.path.normpath(mypath)
    if len(newpath) > 1:
        if newpath[:2] == "//":
            newpath = newpath[1:]
    if TrailingSlash:
        newpath=newpath+'/'
    return newpath

newpath = os.path.normpath(mypath)行中,发生以下堆栈跟踪:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.6/catalyst", line 37, in <module>
    main(sys.argv[1:])
  File "/usr/lib64/python3.6/site-packages/catalyst/main.py", line 285, in main
    return _main(parser, opts)
  File "/usr/lib64/python3.6/site-packages/catalyst/main.py", line 452, in _main
    success = build_target(addlargs)
  File "/usr/lib64/python3.6/site-packages/catalyst/main.py", line 107, in build_target
    target = getattr(module, target)(conf_values, addlargs)
  File "/usr/lib64/python3.6/site-packages/catalyst/targets/livecd_stage2.py", line 30, in __init__
    StageBase.__init__(self,spec,addlargs)
  File "/usr/lib64/python3.6/site-packages/catalyst/base/stagebase.py", line 190, in __init__
    self.set_cdtar()
  File "/usr/lib64/python3.6/site-packages/catalyst/base/stagebase.py", line 398, in set_cdtar
    normpath(self.settings[self.settings["spec_prefix"] + "/cdtar"])
  File "/usr/lib64/python3.6/site-packages/catalyst/support.py", line 251, in normpath
    newpath = os.path.normpath(mypath)
  File "/usr/lib64/python3.6/posixpath.py", line 333, in normpath
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not list

[当Catalyst试图解压Stage tarball时似乎发生了错误,这实际上是不应该发生的-很好,这是stagebase.py中的函数,它构成了堆栈跟踪的一部分:

def set_cdtar(self):
    if self.settings["spec_prefix"] + "/cdtar" in self.settings:
        self.settings["cdtar"] = \
            normpath(self.settings[self.settings["spec_prefix"] + "/cdtar"])
        del self.settings[self.settings["spec_prefix"] + "/cdtar"]

其中的“ spec_prefix”在我的livecd-stage2.spec文件的这一行中是“ livecd / cdtar”:

livecd/cdtar: /usr/share/catalyst/livecd/cdtar/isolinux-elilo-memtest86+-cdtar.tar.bz2

对我来说,这看起来像是连接字符串,而不是列表,除非此处有人有更好的主意。

python gentoo
1个回答
0
投票

好吧,事实证明问题与Python代码无关,但实际上是我的spec文件中的语法错误:

livecd/fsscript=/home/realkstrawn93/Desktop/autocatalyst-gnome/customize.sh

=应该是一个冒号和一个空格。

© www.soinside.com 2019 - 2024. All rights reserved.