scripts下的vaccine.py需要判断是文件还是文件夹
fyplclfkr opened this issue · comments
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Title: scripts. The vaccine.py under scripts needs to determine whether it is a file or a folder.
We use manual creation of folders to immunize against viruses. This tool will report a PermissionError after scanning.
// Error: line 0: PermissionError: file C:\maya_umbrella\scripts\maya_umbrella\filesystem.py line 39: [Errno 13] Permission denied: 'C:/Users/yuping.fan/Documents/maya/scripts\vaccine .py' //
Determining whether it is a folder or a file should solve the problem. It is not ruled out that other people or companies can use similar methods to immunize against viruses
"""Collect all bad userSetup.py files related to the virus."""
for usersetup_py in [
os.path.join(self.api.local_script_path, "vaccine.py"),
os.path.join(self.api.user_script_path, "vaccine.py"),
os.path.join(self.api.local_script_path, "userSetup.py"),
os.path.join(self.api.user_script_path, "userSetup.py"),
]:
print(os.path.isfile(usersetup_py))
if os.path.exists(usersetup_py):
data = read_file(usersetup_py)
if "petri_dish_path = cmds.internalVar(userAppDir=True) + 'scripts/userSetup.py" in data:
self.report_issue("vaccine.py")
self.api.add_bad_file(rename(usersetup_py))
if (
"cmds.evalDeferred('leukocyte = vaccine.phage()')" in data
and "cmds.evalDeferred('leukocyte.occupation()')" in data
):
self.report_issue("userSetup.py")
self.api.add_bad_file(rename(usersetup_py))
vaccine.py这个其实不需要调用read_file,直接删除即可,我现在把列表里相关的两行删除后工作正常了,或者判断一下为文件夹的时候就不删除了
@fyplclfkr 你能提供一个符合这个特征的userSetup.py给我么?我添加到代码的单元测试中
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
@fyplclfkr Can you provide me with a userSetup.py that meets this characteristic? I added to the unit test of the code
@fyplclfkr
当前发布了新版本,可以解决这个问题
https://github.com/loonghao/maya_umbrella/releases/tag/v0.5.0
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
@fyplclfkr
A new version is currently released that can solve this problem
https://github.com/loonghao/maya_umbrella/releases/tag/v0.5.0