[Python-3000] NameError

1 view
Skip to first unread message

Ali art

unread,
Nov 24, 2008, 5:55:01 AM11/24/08
to pytho...@python.org
 
I am using Windows XP professional version 2002 Service pack 3. AMD Athlon(TM)XP 2400+ 2.00GHz 992MB RAM.
 
I have downloaded Windows x86 MSI Instaler Python 3.0rc3 (sig) Release: 21-Nov-2008.
 
Control Panel -> System -> Advanced -> Environment Variables.
System Variables -> Path -> edit C:\Windows\System32\Wbem;C:\Python30
 
start -> programs -> python 3.0 -> IDLE(Python GUI)
-> IDLE 3.0rc3 -> File -> New Window -> i wrote "print('Hello World')" without qutes
-> File -> Save -> Python30 -> i gave file name "helloworld.py" without qutes
-> and saved -> and closed file and python shell

-> and then start -> programs -> python 3.0 -> Python (command line) ->
 
Python 3.0rc3 (r30rc3:67313, Nov 21 2008, 07:14:45) [MSC v.1500 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
 
-> i wrote "helloworld.py" without quotes -> it gives NameError ->
 
Python 3.0rc3 (r30rc3:67313, Nov 21 2008, 07:14:45) [MSC v.1500 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> helloworld.py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'helloworld' is not defined
>>>
 
What did i do wrong?


Discover the new Windows Vista Learn more!

Facundo Batista

unread,
Nov 24, 2008, 6:40:50 AM11/24/08
to Ali art, pytho...@python.org
2008/11/24 Ali art <bil...@hotmail.com>:

>
> What did i do wrong?
>

You should ask these kind of questions in the Python general list:

http://www.python.org/mailman/listinfo/python-list

This Python-3000 list is about developing Python 3 *itself*, not
developing *in* Python

Regards,

--
. Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
_______________________________________________
Python-3000 mailing list
Pytho...@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: http://mail.python.org/mailman/options/python-3000/python-3000-garchive-63646%40googlegroups.com

Chris Rebert

unread,
Nov 24, 2008, 6:54:10 AM11/24/08
to Ali art, pytho...@python.org
On Mon, Nov 24, 2008 at 2:55 AM, Ali art <bil...@hotmail.com> wrote:
>
> I am using Windows XP professional version 2002 Service pack 3. AMD
> Athlon(TM)XP 2400+ 2.00GHz 992MB RAM.
>
> I have downloaded Windows x86 MSI Instaler Python 3.0rc3 (sig) Release:
> 21-Nov-2008.
>
> Control Panel -> System -> Advanced -> Environment Variables.
> System Variables -> Path -> edit C:\Windows\System32\Wbem;C:\Python30
>
> start -> programs -> python 3.0 -> IDLE(Python GUI)
> -> IDLE 3.0rc3 -> File -> New Window -> i wrote "print('Hello World')"
> without qutes
> -> File -> Save -> Python30 -> i gave file name "helloworld.py" without
> qutes
> -> and saved -> and closed file and python shell

You do know you can run the file from within IDLE by just pressing F5, right?

>
> -> and then start -> programs -> python 3.0 -> Python (command line) ->
>
> Python 3.0rc3 (r30rc3:67313, Nov 21 2008, 07:14:45) [MSC v.1500 32 bit
> (Intel)]
> on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>>
>
> -> i wrote "helloworld.py"

No! Wrong! See below.

> without quotes -> it gives NameError ->
>
> Python 3.0rc3 (r30rc3:67313, Nov 21 2008, 07:14:45) [MSC v.1500 32 bit
> (Intel)]
> on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> helloworld.py
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> NameError: name 'helloworld' is not defined
>>>>
>
> What did i do wrong?

As I believe someone pointed out earlier when you previously asked
this question on one of the other mailinglists, to do what you want to
do, you should:
1. Go Start -> Run, enter "cmd", click Run, to open the DOS shell.
2. cd to whatever folder helloworld.py is located in
3. running the following command in the terminal window: python helloworld.py

Python's "shell" is an interactive interpreter of Python *code*, and
is NOT used to run python script *files*, at least in the particular
way you're trying.
When you enter "helloworld.py" at the Python interpreter prompt,
Python is not trying to run the file "helloworld.py"; it's looking for
a variable named "helloworld" to then find the "py" attribute of (i.e.
the dot is an operator in this instance). Since there's obviously no
such variable, it's raising a NameError exception.

For simplicity, I'd recommend just running the script directly from
IDLE as I explained above.

Finally, I echo the comment that your question is completely offtopic
for this mailinglist, which is about developing Python 3.0, not using
Python 3.0 (unless you found a bug, which is not the case here).

Cheers,
Chris
--
Follow the path of the Iguana...
http://rebertia.com

>
> ________________________________
> Discover the new Windows Vista Learn more!

> _______________________________________________
> Python-3000 mailing list
> Pytho...@python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe:

> http://mail.python.org/mailman/options/python-3000/cvrebert%40gmail.com

Reply all
Reply to author
Forward
0 new messages