通过GCP Shell运行以下脚本:
def unpack_model(model_path, uploaded_filename):
""" unpack uploaded zip/rar file """
name, file_type = os.path.splitext(uploaded_filename)
filename = "model{}".format(file_type)
os.rename(os.path.join(model_path, uploaded_filename),
os.path.join(model_path, filename))
Archive(os.path.join(model_path, filename)).extractall(model_path)
os.remove(os.path.join(model_path, filename))
if 'main.py' not in os.scandir(model_path):
copydata(os.path.join(model_path, name), model_path)
shutil.rmtree(os.path.join(model_path, name))
我收到以下错误:
if 'main.py' not in os.scandir(model_path):
[Errno 40] Too many levels of symbolic links: '/app/data/u200315145936ca6bbd1163d/model/m200315153650d8f7069fc0b/model'
我尝试过os.listdir()给了我同样的错误。当脚本在我的本地计算机上运行时,一切正常。
任何人都可以帮助解决此问题吗?