0

I originally wrote some code in python on my windows device, which I then converted to an exe. The application (and exit sequence) work great. Here's the code:

    close = input(">>")
while close != '' \
               '':
    print("Invalid input - try again")
    close = input(">>")
if close == "" \
            "":
    print("Exiting...")
    exit()

I then used the same code in python on Ubuntu so I could create a Linux-friendly version. The exit sequence no longer works and says: NameError, name "exit" not defined. What do I do to make it work on Ubuntu? Thanks!

  • 1
    Please fix the indentation. Correct indentation is critical in Python. – Barmar Jun 22 '20 at 17:34
  • Why are you splitting the code that tests `close` across two lines? – Barmar Jun 22 '20 at 17:34
  • What are you using to convert it to an exe? – martineau Jun 22 '20 at 17:36
  • Sorry, all the code above is part of a larger "if" statement which I didn't want to include. Barmar, this section of code prompting the user to hit "ENTER" to close the program, and I wanted to make it so no other inputs would be accepted. I know there are probably better ways to do it but that's just the way I came up with. Martineau, I used pyinstaller – Goob-The-Noob Jun 22 '20 at 20:05
  • The answer you linked worked great, thanks so much! – Goob-The-Noob Jun 22 '20 at 20:20

0 Answers0