0

I have used several tools (pyinstaller, cx_Freeze, py2exe) to convert my .py file to .exe file. But with each one of these, the resultant .exe file closes as soon as it runs. Here is a screenshot of the exe file created form pyinstaller.

I have looked at several answers on SO and other platforms but haven't been able to find a solution. Any help would be greatly appreciated.

My apologies for not being able to type these traccebacks out here as I had to take a quick screenshot as the window closed in a second.

The .py file runs fine on its own; there's no issue with the code.

Suyash
  • 375
  • 6
  • 18

3 Answers3

0

I had this problem about a year ago with pyinstaller and this 2 methods helped me:

  1. Adding import pkg_resources.py2_warn to my script

  2. Using --onedir instead of --onefile

Ramin-RX7
  • 128
  • 1
  • 1
  • 13
0

You can also do it using cmd:

pip install pyinstaller

cd followed by the location where your Python script is stored so an example is: cd C:\Users\Ron\Desktop\MyPython

then: pyinstaller --onefile pythonScriptName.py instead of pythonscriptname.py, put in your python file name.

When you do this there should be a new file called dist in your directory. Wait for a few mins and there should be an .exe file in there.

VS Puzzler
  • 21
  • 5
0

Here's a temporay solution: I removed all imports related to the googleapiclient for google docs. The .py file gets compiled properly after that.

More Context: There seems to be some issue in this particular library library that causes issues. I have tested the given solutions, they don't seem to work for me. I'll update this answer if I find a "permanent" solution.

Suyash
  • 375
  • 6
  • 18