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

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

Reply via email to