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.



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

Spec File Screenshot

datas=[('C:\Python\Python37-32\Lib\site-packages\tld\res\effective_tld_names.dat.txt', 'tld\res')]