469,283 Members | 2,158 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,283 developers. It's quick & easy.

os.mkdir simple help

Hi there,

I'm totally new to Python and was wondering why I was getting an error
for this. I'm just trying to create a folder based on user input:

import os

def setupProject(project):
os.mkdir(project)
os.chdir(project)

test = input("Please enter project name: ")
setupProject(test)

If I enter "roger" as my input I get : NameError: name 'roger' is not
defined

I know it's incredibly simple but help would be much appreciated!
Thanks in advance!

Feb 19 '06 #1
4 8611
On Sat, 18 Feb 2006 23:51:42 -0800, m.wanstall wrote:
test = input("Please enter project name: ")
setupProject(test)

If I enter "roger" as my input I get : NameError: name 'roger' is not
defined

I know it's incredibly simple but help would be much appreciated!
Thanks in advance!


"input" takes the user-entered string and evaluates it as a Python
expression. You want raw_input().
--
Steven.

Feb 19 '06 #2
That's got it, thanks Steven!

Feb 19 '06 #3
I'm new to python too, but I've read that sys.stdin.readline() is
preferred. Is that right?

Feb 20 '06 #4
My pygtk gui can not be started from a gnome panel,
because, apparently, the panel doesn't know about my
modified PYTHONPATH. So how can I instruct the panel ?
--
Egbert Bouwman - Keizersgracht 197 II - 1016 DS Amsterdam - 020 6257991
================================================== ======================
Feb 20 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Salmo Bytes | last post: by
7 posts views Thread by DataSmash | last post: by
8 posts views Thread by Sue | last post: by
5 posts views Thread by eoindeb | last post: by
30 posts views Thread by MikeC | last post: by
8 posts views Thread by vj | last post: by
3 posts views Thread by Cris | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.