Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52984

Re: multifile programming on python 3

Subject Re: multifile programming on python 3
From Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org>
Date 2013-08-26 00:01 +0430
References <1377418600.6069.9.camel@debian> <kvcsd1$eap$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.225.1377459100.19984.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, 2013-08-25 at 12:13 +0000, Dave Angel wrote:
> 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
> 
> 
At first , thank you, When i post into ML, i get answer on
stackoverflow.

--mohsen

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: multifile programming on python 3 Mohsen Pahlevanzadeh <mohsen@pahlevanzadeh.org> - 2013-08-26 00:01 +0430

csiph-web