472,142 Members | 1,283 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,142 software developers and data experts.

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 8673
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.