pyarmor icon indicating copy to clipboard operation
pyarmor copied to clipboard

path can be case sensitive in windows, resulting `No obfuscated script found` on error

Open ohadcn opened this issue 2 years ago • 3 comments

OS: windows server 2022 python: 3.10 pyarmor version: 7.7.4 pyinstaller version: 5.8.0

I don't know if we should consider this a bug or just leave it here for other people experiencing this behavior to know. When running pyarmor.exe pack in windows path is case sensitive. I could only reproduce this from python, not from command line (I have a python script to compile my project).

C:\work>python >>> from subprocess import check_output >>> open("c:\work\hello.py", "rt").read() 'print("Hello World")' >>> #------------ run with lowercase path fails >>> check_output(r"C:\Python310\Scripts\pyarmor.exe pack hello.py", cwd=r"c:\work", shell=True) INFO PyArmor Trial Version 7.7.4 INFO Python 3.10.10 INFO Prepare to pack obfuscated scripts with PyInstaller... INFO entry script: hello.py INFO src for searching scripts: . INFO build path: dist\obf INFO Run PyArmor to obfuscate scripts... INFO ..... 10312 INFO: Graph cross-reference written to c:\work\build\hello-patched\xref-hello-patched.html Traceback (most recent call last): File "C:\Python310\lib\runpy.py", line 196, in run_module_as_main return run_code(code, main_globals, None, File "C:\Python310\lib\runpy.py", line 86, in run_code exec(code, run_globals) File "C:\Python310\lib\site-packages\PyInstaller_main.py", line 198, in run() File "C:\Python310\lib\site-packages\PyInstaller_main.py", line 180, in run run_build(pyi_config, spec_file, **vars(args)) File "C:\Python310\lib\site-packages\PyInstaller_main.py", line 61, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "C:\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 977, in main build(specfile, distpath, workpath, clean_build) File "C:\Python310\lib\site-packages\PyInstaller\building\build_main.py", line 899, in build exec(code, spec_namespace) File "hello-patched.spec", line 33, in raise RuntimeError('No obfuscated script found') ... >>> #------------ run with uppercase path works >>> a=check_output(r"C:\Python310\Scripts\pyarmor.exe pack hello.py", cwd=r"C:\work", shell=True) INFO PyArmor Trial Version 7.7.4 INFO Python 3.10.10 INFO Prepare to pack obfuscated scripts with PyInstaller... INFO entry script: hello.py INFO src for searching scripts: . INFO build path: dist\obf ... INFO Pack obfuscated scripts successfully. >>>

ohadcn avatar Feb 25 '23 20:02 ohadcn

For my 2 cents...

>>> open("c:\work\hello.py", "rt").read()

you shouldn't use \ regardless...

>>> open("c:/work/hello.py", "rt").read()

If you do you use r

>>> open(r"c:\work\hello.py", "rt").read()

VeNoMouS avatar Feb 26 '23 21:02 VeNoMouS

this example is only intended to show the file content, and aren't part of my script...

ohadcn avatar Feb 26 '23 21:02 ohadcn

Yes. Path is case sensitive even in Windows. I think this is not a big problem and didn't change it because linux and macOS are case sensitive.

jondy avatar Mar 26 '23 04:03 jondy