New install. Getting ImputError

Joshua Macy amused at webamused.com
Sun Jan 23 12:08:57 EST 2000


Thomas D'Urso wrote:
> 
> Just installed / started with Python and reading Learning Python. When I
> try to execute this code:
> 
>    import test
>    from test import vtest    # <-- error on this line
>    print vtest
> 
> file "test" contents:
> 
>    vtest = 'this is a test'
> 
> I get debugger error for 2nd line:    ImputError: cannot input name
> vtest
> The global variable says ImputError is:     Input can't fine module, or
> can't find name in module.
> 
> It give no other errors as far as opening the file. Working on a Mac G4
> with OS 9. Python 1.5.2.
> Doing the "import test.autotest" reports no errors.
> 
> TIA Thomas

The module that you're trying to import has to have the extension .py,
so if the file is actually named just "test" that'll be a problem. 
Otherwise, it works for me.

file test.py
============
vtest = 'This is a test'

Python 1.5.1 (#1, Apr  3 1999, 18:41:12)  [GCC egcs-2.91.60 19981201 (e
on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import test
>>> from test import vtest
>>> print vtest
This is a test

Joshua



More information about the Python-list mailing list