Error running any script in IDLE

M

mattgraves7

Im fairly new to Python. I was trying to run a script using IDLE and it came back with an error and immediately shut down. After this, every script I tried to test within IDLE would do the same. I wrote the following script:

while True
x = input("test")

It seems simple enough to not be screwed up in any way, but when I hit F5 to test, it gets red text and shuts down IDLE. It scrolls too fast to see before shutting down, but I right clicked the text quickly to pause it. This is what it comes back with:
http://s21.postimg.org/4so8merdz/asdfg.png

Can anyone tell me what's going on, and why this error comes up regardless of what script I try to run in IDLE?

If I run it in cmd, it seems to work fine.
 
C

Chris Angelico

Im fairly new to Python. I was trying to run a script using IDLE and it came back with an error and immediately shut down. After this, every script I tried to test within IDLE would do the same. I wrote the following script:

while True
x = input("test")

It seems simple enough to not be screwed up in any way, but when I hit F5 to test, it gets red text and shuts down IDLE. It scrolls too fast to see before shutting down, but I right clicked the text quickly to pause it. This is what it comes back with:
http://s21.postimg.org/4so8merdz/asdfg.png

Can anyone tell me what's going on, and why this error comes up regardless of what script I try to run in IDLE?

It looks like you've made a module called 'random.py', which is
shadowing the standard library 'random' module. In that file, you
appear to have line numbers - note how line 42 is prefixed with the
actual number 42 - and that's causing syntax errors deep inside IDLE.
Try renaming or deleting your random.py to see if that fixes it.

ChrisA
 
M

mattgraves7

Thanks Chris, that worked. Like I said, I'm fairly new to python so I am still learning the ins and outs. Thank you.
 
M

mattgraves7

Thanks Chris, that worked. Like I said, I'm fairly new to python so I am still learning the ins and outs. Thank you.
 
C

Chris Angelico

Thanks Chris, that worked. Like I said, I'm fairly new to python so I am still learning the ins and outs. Thank you.

No probs. You provided all the information needed to solve the
problem, for which I am very much appreciative.

All the best!

ChrisA
 
M

Mark Lawrence

Im fairly new to Python. I was trying to run a script using IDLE and it came back with an error and immediately shut down. After this, every script I tried to test within IDLE would do the same. I wrote the following script:

while True
x = input("test")

I see you've already got an answer but you didn't run the above code as
you'd get a syntax error. As you're new I'll leave you to find out where :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top