Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ohadcn opened this issue Feb 25, 2023 · 3 comments
Assignees
Labels

Comments

@ohadcn
Copy link

ohadcn commented Feb 25, 2023

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.
>>>

@VeNoMouS
Copy link

VeNoMouS commented Feb 26, 2023

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()

@ohadcn
Copy link
Author

ohadcn commented Feb 26, 2023

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

@jondy
Copy link
Contributor

jondy commented Mar 26, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants