Python Forum
Py2EXE: terminal window closes after pressing ENTER
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Py2EXE: terminal window closes after pressing ENTER
#1
I've converted a python script to an exe file, whenever I open the exe the program runs fine and it will ask for user input. But when I do so and press enter it will close the window right away, which didn't happen when it was still a .py file.

When I converted the py file I did get some errors but it seemed python solved those by itself(3 missing modules):

Output:
C:\Python34>python.exe C:\xampp\htdocs\thchchall\install.py install running install running build running install_egg_info Removing C:\Python34\Lib\site-packages\UNKNOWN-0.0.0-py3.4.egg-info Writing C:\Python34\Lib\site-packages\UNKNOWN-0.0.0-py3.4.egg-info C:\Python34>python.exe C:\xampp\htdocs\thchchall\install.py py2exe running py2exe   3 missing Modules   ------------------ ? readline                            imported from cmd, code, pdb ? win32api                            imported from platform ? win32con                            imported from platform Building 'dist\test2.exe'. Building shared code archive 'dist\library.zip'. Copy c:\windows\system32\python34.dll to dist Copy C:\Python34\DLLs\select.pyd to dist\select.pyd Copy C:\Python34\DLLs\_lzma.pyd to dist\_lzma.pyd Copy C:\Python34\DLLs\_bz2.pyd to dist\_bz2.pyd Copy C:\Python34\DLLs\_hashlib.pyd to dist\_hashlib.pyd Copy C:\Python34\DLLs\_ssl.pyd to dist\_ssl.pyd Copy C:\Python34\DLLs\pyexpat.pyd to dist\pyexpat.pyd Copy C:\Python34\DLLs\unicodedata.pyd to dist\unicodedata.pyd Copy C:\Python34\DLLs\_socket.pyd to dist\_socket.pyd Copy C:\Python34\DLLs\_ctypes.pyd to dist\_ctypes.pyd
What causes this behavior?

This is actually the first program I created. So I might miss something?

from array import array import random aKeys = ['wctojxl9gmk8frn','ftzdr4he7ek8a4b','qiwh4yqshtescu6','uh1wdtv7tcjjv98','8cg2202d4zk49tn','ypnqgyldfxweht3','1eqxsz9rlw6swh2','bne3mw7wyapn3is','m1yuwlmxjypodb9','11pqogqvap0z8a2','v3x4lukfq0vlm37','5d0dnyjad1qeoo1','5juzdllxl1lfals','vtsl5eepzsg6sqo','y6u7veu4g6f6lwo','o2b861q2wvshgqi','x7lqey814xl0efz','r6x1r6g6dj3odbw','qyazpwvisijyofq','474zektqgztqxb6','net0n1rqkoy0285','ozrte2g2dt32y23','3qmfvwm21drn8z6','n27brwj9u9i3fjs','7qc5sbtqcq50qv6','jiexqjvhf7hkec7','uxmnvnc9yqqiads','o4930haengedirh','kduc5f59bhcjwcz','6eqoaxmwtcuhq2t'] def GeneratePass(aKeys):     sStringX = ""     iTemp = random.randint(0,len(aKeys[0])-1)     for x in range(0,len(aKeys)):         if(x!=0 and x%5==0):             sStringX += "-"         if(aKeys[x][iTemp].isalpha()):             sStringX += aKeys[x][iTemp].upper()         elif(aKeys[x][iTemp].isnumeric()):             sStringX += aKeys[x][iTemp]     return sStringX def IsValid(sKey,aKeys):     if(sKey==''):         return(False)     if(len(sKey)!=35):         return(False)     sKey = sKey.lower()     sKey = sKey.replace("-","")     for x in range(0,len(aKeys[0])):         if(aKeys[0][x]==sKey[0]):             for y in range(0,len(aKeys)):                 if(aKeys[y][x]!=sKey[y]):                     return (False)             return (True)     return (False) sInput = input("Please enter a serial number:\n") if(IsValid(sInput,aKeys)):     print("Correct") else:     print("Invalid")
Reply
#2
When you run the executable, are you doing so from the command terminal or by double clicking it?
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a way to call and focus any popup window outside of the main window app? Valjean 6 7,714 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  Pyspark Window: perform sum over a window with specific conditions Shena76 0 2,540 Jun-13-2022, 08:59 AM
Last Post: Shena76
  [split] Py2exe Writing UNKNOWN-0.0.0-py3.7.egg-info sarahroxon7 1 1,819 Apr-20-2022, 08:02 AM
Last Post: VadimCr
  Build a matrix by pressing buttons of an interface in Tkinter which extract data from juandiegopulla 1 3,502 Sep-13-2021, 07:28 PM
Last Post: deanhystad
  Py2exe and pycryptodome reks2004 5 7,015 Dec-16-2020, 06:42 PM
Last Post: reks2004
  performs the search without pressing enter or a key forumpy 3 3,182 Sep-22-2020, 11:26 PM
Last Post: deanhystad
  Pressing non-latin characters? Murlog 0 2,234 Jul-25-2020, 03:10 PM
Last Post: Murlog
  Py2exe Writing UNKNOWN-0.0.0-py3.7.egg-info Rickus 2 5,480 Feb-18-2020, 03:09 PM
Last Post: Rickus
  Python instantly closes (Twitch Plays, Python 2) JustHelpMePlease 1 2,896 Jun-16-2019, 06:29 AM
Last Post: stranac
  py2exe failed to compiled gahhon 9 11,423 Mar-04-2019, 03:29 AM
Last Post: gahhon

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.