selenium-wire won't work when python script is compiled with pyarmor
See original GitHub issueHello,
I am currently working on one of my projects and I need seleniumwire in order to monitor requests. It seems to work perfectly while the script is running in .py and inside my IDE, but once I compile the script, I get an error and it won’t start.
Error in question:
cannot import name 'webdriver' from 'seleniumwire' (C:\Users\USER\AppData\Local\Temp\2\_MEI48042\seleniumwire\__init__.pyc)
I am using hidden imports to pack my program, and I think I might be missing something that makes seleniumwire not work at all. Does anyone know the hidden import list required for seleniumwire (if there’s one) ? I would love to use it.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
When Things Go Wrong — PyArmor 6.7.0 documentation
The obfuscated script is a very simple Python script, the first line is an import ... As obfuscating the script by pyarmor ,...
Read more >Trying to use Pyarmor code in python · Issue #265 - GitHub
Hello How can i use pyarmor code in python for eg. subprocess.call("pyarmor pack -e " --onefile --noconsole " + path) I am trying...
Read more >Can't access website with Selenium-wire after using Pyinstaller
I found the solution if someone else has this issue. Go to your python folder, and find the pyinstaller hooks folder, for me...
Read more >How to Obfuscate Python Scripts With PyArmor
The problem with distributing classic Python programs is that anyone can open the files in an editor and read the source code, possibly ......
Read more >Newest 'pyinstaller' Questions - Stack Overflow
I tried pyarmor but to open this file you have to use pytransform. ... os.startfile() doesn't work after compiling python script with pyinstaller....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have just tested this and it seems to work perfectly (even tho Pyinstaller was throwing a lot of errors for some reason, everything works fine). Thank you so much for your help!
Sorry for the delay in replying on this.
I’ve had a play around with pyarmor and pyinstaller and I’ve managed to get a test script to work. To begin with it was giving me the exact same error as you reported
cannot import name 'webdriver' from 'seleniumwire' ...
but I found I had to use the--collect-all
option to pyinstaller to get things to work.To create the obfuscated script:
To create the binary with pyinstaller:
My
main.py
is a simple script that starts a webdriver instance and requests the wikipedia site, before printing the number of requests and ending: