0
votes

Am using Anaconda prompt, after navigating to the folder where the python code is, i ran the command pyinstaller --onefile exercise9.py I noticed that only a file called exercise9.spec was created. i did not see the dist folder where am suppose to find the .exe file as stated by the tutorials am using.

Here is the python code am trying to execute

from getpass import getpass
def login():
     username = input("Please enter your username: ")
     password = getpass("Please enter your password: ")
     return [username, password]
try:
    login_details = login()
    if login_details[0] != "admin": 
        raise ValueError()
    elif login_details[1] != "password":
        print("Wrong Password")

    else:
        print("Login successful")
        input("Press enter to exit")
except ValueError:
    print("Wrong User name")

Here is the content of the exercise9.spec file

block_cipher = None

 a = Analysis(['exercise9.py'],
         pathex=['C:\\Users\\USER\\Desktop\\schoology\\exer9'],
         binaries=[],
         datas=[],
         hiddenimports=[],
         hookspath=[],
         runtime_hooks=[],
         excludes=[],
         win_no_prefer_redirects=False,
         win_private_assemblies=False,
         cipher=block_cipher,
         noarchive=False)
 pyz = PYZ(a.pure, a.zipped_data,
         cipher=block_cipher)
 exe = EXE(pyz,
      a.scripts,
      a.binaries,
      a.zipfiles,
      a.datas,
      [],
      name='exercise9',
      debug=False,
      bootloader_ignore_signals=False,
      strip=False,
      upx=True,
      upx_exclude=[],
      runtime_tmpdir=None,
      console=True )

help me out please i tried with other gui codes i wrote too, but only .spec file is created, am using windows 7.

1

1 Answers

0
votes

I have been able to solve the issue by navigating to the scripts directory in anaconda prompt and entering this command :

python -m PyInstaller --onefile exercise9.py