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


Groups > comp.lang.python > #52976 > unrolled thread

Re: multifile programming on python 3

Started byDave Angel <davea@davea.name>
First post2013-08-25 12:13 +0000
Last post2013-08-25 12:13 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: multifile programming on python 3 Dave Angel <davea@davea.name> - 2013-08-25 12:13 +0000

#52976 — Re: multifile programming on python 3

FromDave Angel <davea@davea.name>
Date2013-08-25 12:13 +0000
SubjectRe: multifile programming on python 3
Message-ID<mailman.218.1377432824.19984.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web