Clocks and Fails


#1

When I run my code below, after entering a word on the console, it just hangs and eventually fails… Any ideas?

print ‘Welcome to the Pig Latin Translator!’

Start coding here!

original = raw_input("Enter a word: ")
print original


#2

Does it hang or is there code in there that says “wait for input”?
Oh you do enter a word.
Do you actually ENTER the word? As in, submitting the input with your enter key?
How can you tell it hangs after entering the word, why not before? Does something happen there?


#3

Having similar experience. Even if code is correct (i.e. am provided the correct code) it hangs and fails…prints peculiar words, like “SCT” (which I didn’t enter, no idea where its getting it from).

The incorrect version and the correct version of the code look identical to me, no idea where the issue is.

Its looking like I have to install python locally to do this…it hangs for a very, very long time.
I’m so disappointed was hoping to use this site.

Can’t say I’m helping you, more like commiserating :frowning:


#4

that has to do with how codecademy runs your code, they aren’t quite separating input streams correctly so they mess up and send your program input that should have gone to another program that runs your program. And I think it happens when not letting your program finish, thereby putting their program in a bad state, a state that you can get out of by reloading the page (turn it off and on again, the usual first tech support advice)

Definitely install python locally either way, dealing with just python, your text editor, and the file system sure rules out a lot of issues that can possibly occur, and whatever trouble you run into will most likely be something you cause yourself, which is great, because that means it’s fixable


#5

I installed python on Mac, ran on IDLE and got immediate message that variable “raw_input” is not defined. So in code academy I added “raw_input” in line above "original = raw_input (“Enter a word:”), now it runs fine.

So good thing I installed Python locally so I have something that gives me helpful error messages…


#6

And that’s an entirely separate issue, one of versions, codecademy uses python 2.7, raw_input got renamed to input in python 3

So you could either use 2.7 locally to keep full compatibility with codecademy, or python 3 while being aware that you will need to change a few things between those two

Yeah, reading the extra stuff they’re sending might let you get around the SCT message if your own input is queued up right behind it. Another work-around is to avoid input entirely, and just write the string directly in the code (which makes running it a whole lot easier too)


#7

Oh sheesh. I don’t think I’ll change my installed version but thanks for the heads up on the version issue…


#8

2.7 and python 3 are happy to co-exist, you wouldn’t need to remove it. And if you’re on a mac then I believe python2 is already installed anyway and you should not have uninstalled that because it’s part of the operating system. (The correct way to install python 3 is to install it alongside the system version, or even in your home directory, not to replace the system’s python)

You can try typing in these commands in bash

python2 --version
python --version
python3 --version

There’s probably a link in /usr/bin named python which refers to python2, and that should stay the way it is. You can however alias python to python3, or add a link somewhere else (such as in ~/bin) so that you hit that first when you type python


#9

Whelp, all I did was go to python.org and download the Mac version. I didn’t uninstall anything - but also, did not see IDLE in Applications until after I did the download. So - perhaps it existed in a form I could not see (who knows)? I did see (in documentation on python site) that python was supposed to be installed already on a Mac but I couldn’t “find” it on my MacBook.

As I’m sure you can tell, I’m just blindly stumbling forward here.


#10

Right so… I would guess that python.org gave you an installer which did the right thing™
And that if you open a terminal and type python, it’ll start python2, and that all is well.

My perspective is that this is the only way to run python, and if it’s got anything to do with graphical menus I’ll be scratching my head and probably be calling it wrong:


#11

Ironically the python shell that opens looks exactly like…a terminal, except the background is white.
So I effectively installed a prettier terminal. Hey I’ll take it…


#12

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.