Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52976
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'repository': 0.05; 'duplicate': 0.07; 'error:': 0.07; 'imported': 0.09; 'latter': 0.09; 'obj': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'eclipse': 0.16; 'nameerror:': 0.16; 'questioned': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:programming': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'trying': 0.19; 'code,': 0.22; 'programming': 0.22; 'import': 0.22; 'portion': 0.22; 'install': 0.23; 'header:User-Agent:1': 0.23; 'module,': 0.24; 'question': 0.24; "i've": 0.25; 'defined': 0.27; 'header:X-Complaints-To:1': 0.27; 'statement': 0.30; "i'm": 0.30; 'class': 0.32; 'run': 0.32; 'there,': 0.34; 'could': 0.34; 'something': 0.35; 'charset:us-ascii': 0.36; 'thank': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'materials': 0.61; 'new': 0.61; "you're": 0.61; "you'll": 0.62; 'name': 0.63; 'dear': 0.65; 'study': 0.69 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dave Angel <davea@davea.name> |
| Subject | Re: multifile programming on python 3 |
| Date | Sun, 25 Aug 2013 12:13:23 +0000 (UTC) |
| References | <1377418600.6069.9.camel@debian> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | 174.32.174.33 |
| User-Agent | XPN/1.2.6 (Street Spirit ; Linux) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.218.1377432824.19984.python-list@python.org> (permalink) |
| Lines | 65 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1377432824 news.xs4all.nl 16004 [2001:888:2000:d::a6]:49249 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:52976 |
Show key headers only | View raw
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