nateshmbhat / webbot

Web automation library for simple and easy end to end testing and web browser automation that offers super charged features while keeping it simple to use and master
https://pypi.org/project/webbot/
Mozilla Public License 2.0
239 stars 87 forks source link

Error after freezing #16

Open Overcooking opened 5 years ago

Overcooking commented 5 years ago

I froze the code, made it into an exe with pyinstaller --onefile then this error comes up The system cannot find the path specified: 'C:\Users\loksa\AppData\Local\Temp\_MEI215642\webbot\drivers\chrome_windows.exe' It works fine when I'm running it with pycharm. Here's my code: https://hastebin.com/mojisokolo.py

DeeJayhX commented 5 years ago

This happens when Browser() is initialized, on line 66 from the code provided above. The traceback for webbot is: File "lib\site-packages\webbot\webbot.py", line 50, in __init__ FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\Users\loksa\AppData\Local\Temp\_MEI215642\webbot\drivers\chrome_windows.exe'

Xanonymus commented 5 years ago

I found a way to fix the issue but it is not the best one. In fact, the problem comes from the file "webbot.py" at line 48 driverpath = os.path.join(os.path.split(__file__)[0] , 'drivers{0}{1}'.format(os.path.sep , driverfilename)) if you print each elements print(os.path.split(__file__)[0]) print('drivers{0}{1}'.format(os.path.sep , driverfilename)) print(driverpath) We see that the path is set akwardly: backslash are not all the same. I think it is a problem for pyinstaller, because it is not able to take the chrome driver in account. C:/Users/xavie/Anaconda3/Lib/site-packages/webbot drivers\chrome_windows.exe C:/Users/xavie/Anaconda3/Lib/site-packages/webbot\drivers\chrome_windows.exe I replaced line 48 by driverpath = 'C:/Users/xavie/Anaconda3/Lib/site-packages/webbot/drivers/chrome_windows.exe' and it worked just fine. Of course you need to change the user name, and check in which library webbot is. But you can find it out by making some print as I did.

Hope it helps ;) Capture d’écran (65)