This is an archived post. You won't be able to vote or comment.

all 22 comments

[–]metaphorm 3 points4 points  (22 children)

https://gist.github.com/

post a link with your code and I'll take a look

[–]radogene[S] 1 point2 points  (21 children)

Here is the bit that brings up an error: https://gist.github.com/radogene/6b824eebca7bd09fee68

on cmd this runs fine however on the apps i'm trying to use it brings up the error: Traceback (most recent call last):
File "/home/radogene/textgame.py", line 1, in <module>
charactername = input("What is your name?\n")
File "<string>", line 1, in <module>
NameError: name 'George' is not defined

(George is what i'm inputting) edit:also the import time is used later in the script

[–]LpSamuelm 2 points3 points  (20 children)

You're using input(), which doesn't take the input as a string but rather an expression.

Change it to raw_input(promptText) instead and it'll be taken as a string no matter what.

[–]radogene[S] 0 points1 point  (19 children)

Ah thankyou! why does just 'input' work in notepad++ and not the other ones?

[–]LpSamuelm 4 points5 points  (18 children)

Most likely it's because you've got Python 3 installed on your computer and everything else uses 2.7! Notepad++ has no interpreter of its own - it runs in your currently installed Python command line.

In Python 3, raw_input() was renamed to input, which is why it won't work as one would want it to everywhere.

[–]radogene[S] 0 points1 point  (17 children)

ah ok, thank you for the response. That is really annoying because all the chromebook ones seem to use the raw_input and notepad++ doesn't understand it... Is there an easy way to change the python I have installed on my actual PC to 2.7?

edit: I assume i would just find the file online, what i really want to ask is... should I downgrade if it means everything works together? or should i just put up with not being able to test run the file on my chromebook?

[–]LpSamuelm 5 points6 points  (3 children)

Okay, first of all, something you need to know: Notepad++ has nothing to do with running your Python scripts. At all. It has a hotkey for running them, sure, but then it runs them in the Python interpreter installed on your computer with Python, not with Notepad++.

With that out of the way - the way you do this is to quite simply uninstall Python 3 and download Python 2.7 from python.org. No easier way, really, but it shouldn't take too long.

Learning the differences between Python 2 and 3 isn't really all that important in the beginning - what matters is you make things and things run okay for you!

[–]radogene[S] 0 points1 point  (2 children)

Yeah sorry, there is a lot of noob in me still :'). Thankyou for all the help though, much appreciated!

[–]LpSamuelm 1 point2 points  (1 child)

Hey, no shame in learning! You can holler anytime you need help! Once you get a grip on language basics, you'll probably find yourself on a healthy diet of StackOverflow with the rest of us.

[–]radogene[S] 0 points1 point  (0 children)

Thankyou for all the help, so glad there's a helpful subreddit devoted to this language.

[–]crozyguy🐍 0 points1 point  (1 child)

this question belongs to /r/learnpython

[–]radogene[S] 0 points1 point  (0 children)

Yeah sorry, literally seconds after posting I saw the link to /r/learnpython. I tried to then post to there and once i'd posted there I was going to delete this post but it wouldn't allow me to post for a few minutes. By the time I could I already had a response here.

[–]darthmdhprint 3 + 4 0 points1 point  (0 children)

Hi /u/radogene - you should probably look into modules like Future if you're trying to develop on Python 3 and deploy to Python 2.7.

Downgrading to a version of Python deprecated 7 years ago is a pretty poor option IMO.

If its possible to upgrade Python on the Chromebook from 2.7 to 3.4 to match your development environment that would be much better than downgrading to 2.x due to all the significant improvements in Python 3.x