The copied file won't open and other problem


My problem is that, first is when i copy and past to idle for example this:

input(“\n\nclick Enter.”)

this shows me error:
SyntaxError: multiple statements found while compiling a single statement

When i save this in “” file, i click file and window dissapear.

Another strange thing is that, i have old .py files in folder that i did before and its working, but when i copy this file to other folder its not working anymore.

I dont know how to solve this problems, before was seems all working fine, and now not.

Thank you for help.

Start a cmd window and run your .py files from the command line.
If you installed python from then


Is all you need.

The reason that you saw the window flash past is that your python code is not a GUI program.

As a command line program it started a console window,
ran the script and the closed the window.

For the IDLE part: print and input are 2 separate statements. Enter one statement at a time in Shell. Either paste and delete 1 before Enter or paste into an IDLE editor and run.

@barry-scott Input statements at the end of a file are a way to prevent the window from disappearing until one hits the enter/return key. Unclear to me what the problem is.

1 Like

it seems to be something wrong with my pc.
When i will do same thing on other pc its working.
I do simple program i click on it, window comes out and its all like should be.
On my PC, when i do same program in idle, i save it and i click on it, its behave like without “input(“\n\nclick Enter.”)” commend its closing imidiatly.
Old programs that i had saved in some folder, are working good, but when i will copy them to other folder, they stop working.
One idea that i have its maybe some other program prevent me to open this new files on my pc.
Antivirus maybe. I will do format anyway.

Thank you for reply

Yep used that trick before as well as time.sleep(5) to keep the windows long enough to read.

If you have the py launcher installed and associated with “.py” files, a simple workaround for testing is to use a shebang that exits into interactive mode, e.g. “#!/usr/bin/python3 -i”. This works even if the script exits due to an unhandled exception.

I don’t use this shebang technique much anymore, at least not in Windows 11. I have Terminal set as my default terminal. It can be configured to keep the tab of a console session open after the session has ended. Or it can be configured to keep the tab open only when the process that allocated the console (e.g. “py.exe”) exits with a non-zero status code.