os.mkdir simple help

M

m.wanstall

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!
 
S

Steven D'Aprano

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().
 
X

XBello

I'm new to python too, but I've read that sys.stdin.readline() is
preferred. Is that right?
 
E

egbert

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 ?
 

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

No members online now.

Forum statistics

Threads
474,285
Messages
2,571,416
Members
48,108
Latest member
AmeliaAmad

Latest Threads

Top