I have written small code in python for data scraping using selenium, and BeautifulSoup.
The code is working great in pyCharm but when I convert my file from .py to EXE using pyinstaller example.py command, it converts correctly but the EXE file flashes and terminates and the code doesn't execute.
This is the result of the pyinstaller command:
This happens when there is an error being faced by the python script. Try running the .py module file in IDLE or by simple double clicking the .py .
I guess pyCharm creates a virtual environment which might be causing the issue.
Maybe try adding try/except for the code so that it doesn't flick away, rather shows the error.
Related
I'm trying to make my python script executable file. However, when I convert it to exe with pyinstaller or py2exe, executable file does not work. I opened in cmd, no error but still does not work as i expected. On the other hand, when I start the actual python script, it works without a problem.
Here is what my folder structure looks like:
account_details.json
posts.xls
actual_python_script.py
What could be the problem and how can I solve this?
I am a beginner in python and seeking some help on this matter. I want to convert my python script into .exe file which can further be used by the user that don't have python installed. I used to be able to create .exe files using pyinstaller and they worked perfectly. I had used the libraries like pandas, numpy, datetime, pyodbc.
Now, I created a new script that ran perfectly using jupyter notebook and I converted it into exe file, but when I run the file, it opens the command prompt and stays open forever but does nothing. I had two new libraries that I used this time 'xlwings', 'shutil'. I thought that might be the problem so I ran the same script removing those two libraries but still can't get it working. I am completely stuck here and couldn't figure what went wrong.
I've added a print('Start') command in the beginning of the script but the exe file doesn't even read that. Seems like it isn't executing the code at all.
I am using python 3.9.5 and PyInstaller version 4.10 and running it on windows 10.
Thanks in advance.
I made "exe" file using pyinstaller .
(command in cmd window : pyinstaller -w -F test.py and using many command)
It worked fine when I ran it before, but since I started writing a new Python file,
The "exe" file have problems.
files are generated well, but when I run this "exe" program.
error window pop up like this : python failed to execute script test.py
I looked for this problem all the web, but I couldn't find how to fix it
i'm using PYQT5 gui program, but there is no image
and
3.6.1 versino python 32bit
if you add new changes, try to delete the files generated on your first run of creating the .exe and try again with a clean folder structure
I am trying to turn a .py file into .exe so that it's runnable on other computers without python. I followed this tutorial, installed pyinstaller then ran the command pyinstaller --onefile IRV.py without the -w since my program runs in the console. It successfully built the .exe file but when I run it it immediately closes even though the program itself asks for input at the beginning. It uses a bunch of .txt and .xslx files from the folder of the .py file so I dragged the .exe out of the dist folder but it still gives the same error. I managed to make a quick print screen before it closes and it gives me this error: https://imgur.com/a/w7TVjaN
The script doesn't even work if I double click the .py file. However it runs perfectly fine if I open up the .py file in an IDE like Spyder. When I run the .exe file it opens up the cmd for a few seconds with nothing written on it and then quickly writes that error I managed to screenshot and then closes. If I double click the .py though it instantly closes without the wait or the error message.
Pyinstaller didn't find the libraries or modules you imported. In the build folder that was deleted in the tutorial, there's a text document that shows warnings for libraries that aren't found by the pyinstaller. You may need to check that.
This Q&A mentioned a problem that is related to your Question: No module error when running python script from command prompt
Wrote a game and compiled it with pyinstaller. An EXE file was created but when I go to run it, it thinks for 3-4 seconds and then it returns to command prompt.
Clicking from the folder in Windows does nothing.
No errors, nothing! Do I need something in my code to allow this to run? The only imports are tkinter and random.
Edit 1: tested a "hello world" script to see if there were issues with pyinstaller, it ran fine.
I understand that the post is older, but it may be useful for other member who may come across the similar problem.
I had created a script using Jupiter notebook and it creates ipynb file.
When I create an exe file using pyinstaller, the exe was doing nothing.
I resolved it by first converting ipynb file to py file using below command:
pyinstaller my_script.py
It will create the py file under same location.
Now, execute below command to create exe file:
pyinstaller my_script.py
It will create exe file under dist folder.
And it works.