No such file or directory in pyinstaller - python-3.x

When I try to run a .exe file made with python, I get the following message:
No such file or directory:
'C:\Users\[myUsername]\AppData\Local\Temp\_MEI171122\tldextract\.tld_set'
What should I do?

Related

how to Run .py file

I have written a "random movie suggester" code that will basically read the files of the directory where the .py file is stored and randomly pick one of them and print it out.
My problem is -
How to make .py file simple to run for non-technical person?
(e.g. I tried .bat but i had to hard code the path of the file).
Other solutions ask to install IDEs and run it.
First you have to install python on your computer.
Then you can type in your terminal:
python [the file name or the path to access it]
But I don't think this is what you are looking for...
You can create a .exe file with your python program using the pyinstaller module then running this in your terminal.
pip pyinstaller
pyinstaller --onefile [the name of the file]
The first line installs the module using pip.
The second line will create a .exe file that does exactly the same as your python code.

How can I decompile an exe file I made with Pyinstaller?

I made a .py file and was looking how to convert it into an .exe file. I found pyinstaller and while messing around with it I was able to create a basic exe file with pyinstaller. The problem is that I didnt have a copy of my .py file as backup because I'm a beginner and now I can't look at my source code. Is there a way for me to decompile the pyinstaller files to attempt to recover some of my code?
My .py file was created in python 3.8 if that is relevant

Problems after generating the exe from a py file

I am using Python Version 3.7.3 and PyInstaller 3.5. I have written a Python script named read.py which will read the scanned PDF and convert it to a text file. I could successfully generate the exe using the PyInstaller commands pyi-makespec --onefile read.py and pyinstaller --onefile read.spec. The .exe file is working fine in my system where i have all the packages installed, but when I tried to run it on a different Windows PC where the Python packages are not available, it is looking for the poppler module.
I even tried to add the hook file for poppler in pyinstaller hooks folder but it did not take this hook file while generating the .exe file.
Please help to resolve this issue, or please let me know if there is any other way to generate the exe without having the dependencies on the Python supporting files.
Below is the error which I'm getting when I execute the .exe file on a different PC:
File "read_image.py", line 29, in <module>
File "site-packages\pdf2image\pdf2image.py", line 54, in convert_from_path
File "site-packages\pdf2image\pdf2image.py", line 244, in _page_count pdf2image.exceptions.PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH? [17920] Failed to execute script read_image
Thanks for the Help...

tkroot.tk.call() raises an error after making the exe file

My .py file is working with no errors. But after making exe file using pyinstaller and when I run the exe file, it gives following error;
File "site-packages\TkinterDnD2\TkinterDnd.py, line 271, in __init__
File "site-packages\TkinterDnD2\TkinterDnd.py, line 41, in _require
RuntimeError: Unable to load tkdnd library.
I checked the lines mentioned above in TkinterDnd.py and found that it raises a runtime error due to tkroot.tk.call() function.
Please help me to correct this error.
When you build EXE with pyinstaller try add
--hidden-import TkinterDnD2

Python APScheduler keyerror

I have created a .exe file for a .py file with cx_Freeze and pyinstaller, and when im running that file, cmd is generating error:
File "site-packages\apscheduler\schedulers\base.py", line 893, in _create_plugin_instance
KeyError: 'interval'
i have defined a apscheduler job as:
#sched.scheduled_job('interval', seconds=120)
I dont know how to handle this error, when im running my .py file there is no error generated.
Any help is appreciated.
cx_Freeze and PyInstaller both omit metadata vital to APScheduler from the packed .exe file. For this reason, setuptools entry points do not work. The workaround:
from apscheduler.triggers.interval import IntervalTrigger
#sched.scheduled_job(IntervalTrigger(seconds=120))

Resources