Code Doesn't Run After Packaging With Pyinstaller
I created a code using robobrowser to check website status and log that into a file, and mail if the HTTP Response is anything else than 400.
Later I had to add Pypac, since my systems are behind a proxy.
Rest of the code works after packaging. I have tried in different machines(which aren't behind proxies)
As soon as I add the proxy the packaged .exe
stops working.
I have tried to add 'pypac' in Hidden Imports as well.
from pypac import PACSession
from robobrowser import RoboBrowser
session = PACSession()
browser = RoboBrowser(history=True, session=session)
Since the proxy part is not working.
It is throwing errors like:
"urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"
When I run the same code using python. There's no error.
Answer
I just redid a small code with just PyPac and package it with Pyinstaller with console=True.
The returned error was
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\CHOWDH~1\AppData\Local\Temp\_MEI199722\tld\res\effective_tld_names.dat.txt'
So while packaging I added the data using the spec file C:\Python\Python37-32\Lib\site-packages\tld\res
datas=[('C:\Python\Python37-32\Lib\site-packages\tld\res\effective_tld_names.dat.txt', 'tld\res')]
Related Questions
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Django, code inside <script> tag doesn't work in a template
- → React - Django webpack config with dynamic 'output'
- → GAE Python app - Does URL matter for SEO?
- → Put a Rendered Django Template in Json along with some other items
- → session disappears when request is sent from fetch
- → Python Shopify API output formatted datetime string in django template
- → Can't turn off Javascript using Selenium
- → WebDriver click() vs JavaScript click()
- → Shopify app: adding a new shipping address via webhook
- → Shopify + Python library: how to create new shipping address
- → shopify python api: how do add new assets to published theme?
- → Access 'HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT' with Python Shopify Module