Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52976
| From | Dave Angel <davea@davea.name> |
|---|---|
| Subject | Re: multifile programming on python 3 |
| Date | 2013-08-25 12:13 +0000 |
| References | <1377418600.6069.9.camel@debian> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.218.1377432824.19984.python-list@python.org> (permalink) |
Mohsen Pahlevanzadeh wrote:
> Dear all,
>
> I need help about multifile programming on python 3 and i questioned on
> stackoverflow :
> http://stackoverflow.com/questions/18391230/eclipse-python-nameerror-name-mymodule-is-not-defined
>
> I thank you if you answer me.
>
> --mohsen
You have a response there, so I'm not sure why you're trying to
duplicate it here.
A portion of your question there:
> import repository;
>
>
> x = Repository();
> When i run my application, i get the following error:
>
> x = Repository();
>
> NameError: name 'Repository' is not defined
That's not the whole error, that's just the last line of it. Still the
immediate answer is clear:
after the statement
import repository
one new symbol is available to your code, the symbol 'repository'
if you want to use something defined in that imported module, then use
obj = repository.Repository()
Or you could do one of these two:
import repository
Repository = repository.Repository #defines new name for the class
Materials = repository.Materials #ditto
or
from repository import Repository, Materials
In either of those latter cases, you could now create the object by
obj = Repository()
As for the Eclipse problem, you'll have to study the other answer; I've
never found it worthwhile to install Eclipse for Python.
--
DaveA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: multifile programming on python 3 Dave Angel <davea@davea.name> - 2013-08-25 12:13 +0000
csiph-web