Re: Flask import problem with Python 3 and __main__.py

2014-08-26 Thread Jon Ribbens
On 2014-08-26, Terry Reedy wrote: > On 8/26/2014 12:03 PM, Jon Ribbens wrote: >> Flask suggests the following file layout: >> >> runflaskapp.py >> flaskapp/ >> __init__.py >> >> runflaskapp.py contains: >> >> from flaskapp import app >> app.run(debug=True) >> >> flaska

Re: Flask import problem with Python 3 and __main__.py

2014-08-26 Thread Terry Reedy
On 8/26/2014 12:03 PM, Jon Ribbens wrote: Flask suggests the following file layout: runflaskapp.py flaskapp/ __init__.py runflaskapp.py contains: from flaskapp import app app.run(debug=True) flaskapp/__init__.py contains: from flask import Flask app = F

Flask import problem with Python 3 and __main__.py

2014-08-26 Thread Jon Ribbens
Flask suggests the following file layout: runflaskapp.py flaskapp/ __init__.py runflaskapp.py contains: from flaskapp import app app.run(debug=True) flaskapp/__init__.py contains: from flask import Flask app = Flask(__name__) Running this with 'python3 runflask

Re: import problem

2013-09-16 Thread Dave Angel
On 16/9/2013 00:05, Mohsen Pahlevanzadeh wrote: > thank you, you gave me "how to get fish" instead of "fish", it's very > better. I'd suggest you make a diagram showing each file and indicate what files it imports by an arrow. If any arrows form a circle, you (may) have recursive imports. You s

Re: import problem

2013-09-15 Thread Mohsen Pahlevanzadeh
On Mon, 2013-09-16 at 11:14 +0430, Mohsen Pahlevanzadeh wrote: > On Mon, 2013-09-16 at 02:56 +, Steven D'Aprano wrote: > > On Mon, 16 Sep 2013 06:53:26 +0430, Mohsen Pahlevanzadeh wrote: > > > > > Dear all, > > > > > > i have the following two line codes: > > > >

Re: import problem

2013-09-15 Thread Mohsen Pahlevanzadeh
On Mon, 2013-09-16 at 02:56 +, Steven D'Aprano wrote: > On Mon, 16 Sep 2013 06:53:26 +0430, Mohsen Pahlevanzadeh wrote: > > > Dear all, > > > > i have the following two line codes: > > > > import ui.interface.interface > > obj = ui.interface.inter

Re: import problem

2013-09-15 Thread Mohsen Pahlevanzadeh
thank you, you gave me "how to get fish" instead of "fish", it's very better. On Mon, 2013-09-16 at 02:56 +, Steven D'Aprano wrote: > On Mon, 16 Sep 2013 06:53:26 +0430, Mohsen Pahlevanzadeh wrote: > > > Dear all, > > > > i have the following two line codes: > > >

Re: import problem

2013-09-15 Thread Steven D'Aprano
On Mon, 16 Sep 2013 06:53:26 +0430, Mohsen Pahlevanzadeh wrote: > Dear all, > > i have the following two line codes: > > import ui.interface.interface > obj = ui.interface.interface.InterfaceCodes() > ###333 > I have same code in a

import problem

2013-09-15 Thread Mohsen Pahlevanzadeh
Dear all, i have the following two line codes: import ui.interface.interface obj = ui.interface.interface.InterfaceCodes() ###333 I have same code in another package and work fine. but i get the : ##

Re: Import Problem on WIndows py3

2012-09-04 Thread Jimbo Jim
On Tuesday, September 4, 2012 1:45:55 PM UTC-7, Werner Thie wrote: > On 9/4/12 9:49 AM, jimmyli1528 wrote: > > > I have a main program and a 3rd party module. Trying to import colorama, > > where colorama is a folder with files in it, returns an ImportError: No > > module named colorama. How sho

Re: Import Problem on WIndows py3

2012-09-04 Thread Werner Thie
On 9/4/12 9:49 AM, jimmyli1...@gmail.com wrote: I have a main program and a 3rd party module. Trying to import colorama, where colorama is a folder with files in it, returns an ImportError: No module named colorama. How should I import folders? Do you have a (empty) __init__.py file present

Import Problem on WIndows py3

2012-09-04 Thread jimmyli1528
I have a main program and a 3rd party module. Trying to import colorama, where colorama is a folder with files in it, returns an ImportError: No module named colorama. How should I import folders? -- http://mail.python.org/mailman/listinfo/python-list

Re: A thread import problem

2012-07-23 Thread Bruce Sherwood
I'm happy to report that Robin Dunn, the developer of wxPython, showed me how to solve my VPython architectural problem, using wxPython. I attach a test program based on wxPython that has all of the properties I was looking for (though it needs some minor cleanups, including quitting gracefully, an

Re: A thread import problem

2012-07-23 Thread Dieter Maurer
Bruce Sherwood writes: > ... > There's nothing wrong with the current VPython architecture, which > does use good style, but there are two absolute, conflicting > requirements that I have to meet. > > (1) The simple program API I've shown must be preserved, because there > exist a large number of

Re: A thread import problem

2012-07-23 Thread Bruce Sherwood
Thanks much for the useful suggestion, and also thanks for your sympathy and understanding of my plight! Bruce Sherwood On Sun, Jul 22, 2012 at 11:50 PM, Devin Jeanpierre wrote: > On Sun, Jul 22, 2012 at 7:14 PM, Bruce Sherwood > wrote: >> (2) My hand is forced by Apple no longer supporting Car

Re: A thread import problem

2012-07-22 Thread Devin Jeanpierre
On Sun, Jul 22, 2012 at 7:14 PM, Bruce Sherwood wrote: > (2) My hand is forced by Apple no longer supporting Carbon. Among > other aspects of this, Carbon can't be used with 64-bit Python, and > more and more Mac users of VPython want to use 64-bit Python. So there > has to be a version of VPython

Re: A thread import problem

2012-07-22 Thread Bruce Sherwood
On Sun, Jul 22, 2012 at 3:48 PM, Dennis Lee Bieber wrote: > On Sun, 22 Jul 2012 13:04:25 -0600, Bruce Sherwood > declaimed the following in > gmane.comp.python.general: > > >> Another way of saying this is that I'm not building an app, in which >> case I would structure things in a simple and str

Re: A thread import problem

2012-07-22 Thread Bruce Sherwood
On Sat, Jul 21, 2012 at 5:47 PM, Dennis Lee Bieber wrote: > On Sat, 21 Jul 2012 17:10:05 -0600, Bruce Sherwood > declaimed the following in > gmane.comp.python.general: > > >> Thanks, but the problem I need to solve does not permit putting a >> function like runner in the main program. I'm constr

Re: A thread import problem

2012-07-21 Thread Dieter Maurer
Bruce Sherwood writes: > ... > The failure of this test case suggests that one cannot do imports > inside secondary threads started in imported modules, something I keep > tripping over. But I hope you'll be able to tell me that I'm doing > something wrong! As you know multiple threads can be dan

Re: A thread import problem

2012-07-21 Thread Dieter Maurer
Bruce Sherwood writes: > Thanks much for this suggestion. I'm not sure I've correctly > understood the operation "start_new_thread(lambda: __import__( module>), ())". By "your module" do you mean the user program which > imported the module that will execute start_new_thread? By "your_module", I

Re: A thread import problem

2012-07-21 Thread Bruce Sherwood
On Sat, Jul 21, 2012 at 4:16 PM, Dennis Lee Bieber wrote: > On Sat, 21 Jul 2012 10:11:30 -0600, Bruce Sherwood > declaimed the following in > gmane.comp.python.general: > > >> >> --- >> testABA.py -- execute this file >> >> from ABA import * >> print('exec testABA') >> fro

Re: A thread import problem

2012-07-21 Thread Dave Angel
On 07/21/2012 05:35 PM, Bruce Sherwood wrote: > On Sat, Jul 21, 2012 at 2:53 PM, Dave Angel wrote: >> >> For docs on the threading thing, see: >> >> http://docs.python.org/library/threading.html >> >> " ... an import should not have the side effect of spawning a new thread >> and then waiting for

Re: A thread import problem

2012-07-21 Thread Bruce Sherwood
On Sat, Jul 21, 2012 at 2:53 PM, Dave Angel wrote: > On 07/21/2012 04:36 PM, Bruce Sherwood wrote: >> Thanks much for this clear statement. I hadn't managed to find any >> documentation on this specific issue. >> >> Bruce Sherwood >> >> On Sat, Jul 21, 2012 at 10:26 AM, Dave Angel wrote: >>> Two

Re: A thread import problem

2012-07-21 Thread Dave Angel
On 07/21/2012 04:36 PM, Bruce Sherwood wrote: > Thanks much for this clear statement. I hadn't managed to find any > documentation on this specific issue. > > Bruce Sherwood > > On Sat, Jul 21, 2012 at 10:26 AM, Dave Angel wrote: >> Two of the things you mustn't do during an import: >> >> 1) start

Re: A thread import problem

2012-07-21 Thread Bruce Sherwood
Thanks much for this clear statement. I hadn't managed to find any documentation on this specific issue. Bruce Sherwood On Sat, Jul 21, 2012 at 10:26 AM, Dave Angel wrote: > Two of the things you mustn't do during an import: > > 1) start or end any threads > 2) import something that's already in

Re: A thread import problem

2012-07-21 Thread Dave Angel
On 07/21/2012 10:54 AM, Bruce Sherwood wrote: > Thanks much for this suggestion. I'm not sure I've correctly > understood the operation "start_new_thread(lambda: __import__( module>), ())". By "your module" do you mean the user program which > imported the module that will execute start_new_thread?

Re: A thread import problem

2012-07-21 Thread Bruce Sherwood
I couldn't get a simple test case to work. I append a listing of the little test files, all in the same folder. The diagnostic statement print('after start_new_thread\n') works, but then nothing. Originally I tried importing testABA.py but was worried that the circular importing (A imports B which

Re: A thread import problem

2012-07-21 Thread Bruce Sherwood
Thanks much for this suggestion. I'm not sure I've correctly understood the operation "start_new_thread(lambda: __import__(), ())". By "your module" do you mean the user program which imported the module that will execute start_new_thread? It hadn't occurred to me to have A import B and B import A,

Re: A thread import problem

2012-07-21 Thread Dieter Maurer
Bruce Sherwood writes: > ... > from visual import box, rate > b = box() > while True: > rate(100) # no more than 100 iterations per second > b.pos.x += .01 > > This works because a GUI environment is invoked by the visual module > in a secondary thread (written mainly in C++, connected to

Re: A thread import problem

2012-07-20 Thread Bruce Sherwood
Dieter Maurer commented the following on my question about a thread import problem: -- In a recent discussion in this list someone mentioned that on module import, you should not start a thread. The reason: apparently, Python uses some kind of locking during import which can

Re: A thread import problem

2012-07-19 Thread Dieter Maurer
Bruce Sherwood writes: > I'm trying to do something rather tricky, in which a program imports a > module that starts a thread that exec's a (possibly altered) copy of > the source in the original program, and the module doesn't return. > This has to do with an attempt to run VPython in the Mac Co

A thread import problem

2012-07-18 Thread Bruce Sherwood
I'm trying to do something rather tricky, in which a program imports a module that starts a thread that exec's a (possibly altered) copy of the source in the original program, and the module doesn't return. This has to do with an attempt to run VPython in the Mac Cocoa context, in which Cocoa is re

possible circular import problem with python-3, but not python-2

2010-09-27 Thread Darren Dale
py/h5a.c:5248) File "h5p.pxd", line 23, in init h5py.h5t (h5py/h5t.c:16481) File "h5t.pxd", line 17, in init h5py.h5p (h5py/h5p.c:9297) ImportError: No module named h5t That looks like it might be a circular import problem, but it works fine with python-2.6. I'm at a lo

Re: Import problem

2010-03-10 Thread News123
Hi JM, Jean-Michel Pichavant wrote: > News123 wrote: >> Jean-Michel Pichavant wrote: >> >>> Johny wrote: >>> I have this directory structure C: \A __init__.py amodule.py \B __init__.py bmod

Re: Import problem

2010-03-10 Thread News123
Hi JM, Jean-Michel Pichavant wrote: > News123 wrote: >> Jean-Michel Pichavant wrote: >> >>> Johny wrote: >>> I have this directory structure C: \A __init__.py amodule.py \B __init__.py bmod

Re: Import problem

2010-03-10 Thread Jean-Michel Pichavant
News123 wrote: Jean-Michel Pichavant wrote: Johny wrote: I have this directory structure C: \A __init__.py amodule.py \B __init__.py bmodule.py \D __init__.py dmodule.py and I want to import bm

Re: Import problem

2010-03-08 Thread News123
Jean-Michel Pichavant wrote: > Johny wrote: >> I have this directory structure >> >> C: >> \A >> __init__.py >> amodule.py >> >> \B >> __init__.py >> bmodule.py >> >>\D >> __init__.py >> dmodule.py >> >> and I

Re: Import problem

2010-03-08 Thread News123
Jean-Michel Pichavant wrote: > Johny wrote: >> I have this directory structure >> >> C: >> \A >> __init__.py >> amodule.py >> >> \B >> __init__.py >> bmodule.py >> >>\D >> __init__.py >> dmodule.py >> >> and I

Re: Import problem

2010-03-08 Thread News123
Hi Steven, Steven D'Aprano wrote: > On Sat, 06 Mar 2010 03:53:53 -0800, Johny wrote: > > import sys > sys.path.append('C:\\A') > from A.B import bmodule >> Traceback (most recent call last): >> File "", line 1, in >> ImportError: No module named A.B > > The current directory is irre

Re: Import problem

2010-03-08 Thread Jean-Michel Pichavant
Johny wrote: I have this directory structure C: \A __init__.py amodule.py \B __init__.py bmodule.py \D __init__.py dmodule.py and I want to import bmodule.py C:\>cd \ C:\>python Python 2.5 (r25:51908, S

Re: Import problem

2010-03-06 Thread Steven D'Aprano
On Sat, 06 Mar 2010 03:53:53 -0800, Johny wrote: import sys sys.path.append('C:\\A') from A.B import bmodule > Traceback (most recent call last): > File "", line 1, in > ImportError: No module named A.B The current directory is irrelevant, except that it is automatically added

Import problem

2010-03-06 Thread Johny
I have this directory structure C: \A __init__.py amodule.py \B __init__.py bmodule.py \D __init__.py dmodule.py and I want to import bmodule.py C:\>cd \ C:\>python Python 2.5 (r25:51908, Sep 19 2006, 09:

Re: tkinter import problem

2009-12-21 Thread Gabriel Genellina
En Sun, 20 Dec 2009 02:04:17 -0300, harish anand escribió: I have Mandriva 2010.0 in my laptop. I installed python3.1 from the repository. But i am unable to import tkinter in python console. When I try to import tkinter I get the following error, `ImportError : No module named _tkinter`

Re: Import Problem

2009-12-20 Thread Chris Rebert
On Sun, Dec 20, 2009 at 3:34 AM, Victor Subervi wrote: > But I get this error: > > /var/www/html/angrynates.com/cart/createTables2.py >   263 >   264 ''' >   265 >   266 createTables2() >   267 > createTables2 = >  /var/www/html/angrynates.com/cart/createTables2.py in createTables2() >   105   

Import Problem

2009-12-20 Thread Victor Subervi
Hi; I have this import statement: from particulars import storePrimaryStandAlone, addStore, ourStores particulars.py has this code: def addStore(): return 'jewelry' def ourStores(): return ['products', 'prescriptions'] def storePrimaryStandAlone(): return 'prescriptions' But I get this

tkinter import problem

2009-12-19 Thread harish anand
Hi, I have Mandriva 2010.0 in my laptop. I installed python3.1 from the repository. But i am unable to import tkinter in python console. When I try to import tkinter I get the following error, `ImportError : No module named _tkinter` Am I doing something wrong? Thanks, -- http://mail.python.

Re: import problem in tkinter

2009-10-30 Thread Peter Otten
Dave Angel wrote: > Jebegnana das wrote: >> import _tkinter # If this fails your Python may not be configured for Tk >> >> I'm using python3 in linux. In windows tkinter is working fine but in >> mandriva linux spring 2009 it fails to import. Can you please tell me >> step-by-step on how to fix th

Re: import problem in tkinter

2009-10-30 Thread Dave Angel
Jebegnana das wrote: import _tkinter # If this fails your Python may not be configured for Tk I'm using python3 in linux. In windows tkinter is working fine but in mandriva linux spring 2009 it fails to import. Can you please tell me step-by-step on how to fix this issue? In python3.1 home page

import problem in tkinter

2009-10-30 Thread Jebegnana das
import _tkinter # If this fails your Python may not be configured for Tk I'm using python3 in linux. In windows tkinter is working fine but in mandriva linux spring 2009 it fails to import. Can you please tell me step-by-step on how to fix this issue? In python3.1 home page the description is not

win32com.client import problem : solved

2009-10-14 Thread Threader Slash
-- Forwarded message -- From: Dave Angel To: Threader Slash Date: Wed, 14 Oct 2009 07:04:21 -0400 Subject: Re: win32com.client import problem Threader Slash wrote: > Hi Everybody, > > I have 2 imports: > > import pythoncom > from win32com.client import Dispat

Re: win32com.client import problem

2009-10-14 Thread Dave Angel
Threader Slash wrote: Hi Everybody, I have 2 imports: import pythoncom from win32com.client import Dispatch if I run it on my Python 2.6 Console, it works nicely. However, when I go to Eclipse IDE, open a project, open a main.py file, and try run, it gives the error: import pythoncom ImportEr

win32com.client import problem

2009-10-14 Thread Threader Slash
Hi Everybody, I have 2 imports: import pythoncom from win32com.client import Dispatch if I run it on my Python 2.6 Console, it works nicely. However, when I go to Eclipse IDE, open a project, open a main.py file, and try run, it gives the error: import pythoncom ImportError: No module named pyt

Re: Import Problem - Please help

2009-09-07 Thread newb.py
On Sep 7, 6:55 pm, Ned Deily wrote: > In article > <8119a298-4660-4680-b460-0924c9baa...@e4g2000prn.googlegroups.com>, > >  "newb.py" wrote: > > On Sep 7, 5:40 pm, "newb.py" wrote: > > > I am trying to learn NLP with Python and am getting the following > > > error when trying to do an import sta

Re: Import Problem - Please help

2009-09-07 Thread Ned Deily
In article <8119a298-4660-4680-b460-0924c9baa...@e4g2000prn.googlegroups.com>, "newb.py" wrote: > On Sep 7, 5:40 pm, "newb.py" wrote: > > I am trying to learn NLP with Python and am getting the following > > error when trying to do an import statement: > > > > >>> import nltk > > >>> import re

Re: Import Problem - Please help

2009-09-07 Thread newb.py
On Sep 7, 5:40 pm, "newb.py" wrote: > I am trying to learn NLP with Python and am getting the following > error when trying to do an import statement: > > >>> import nltk > >>> import re > >>> from nltk_lite.utilities import re_show > > Traceback (most recent call last): >   File "", line 1, in >

Import Problem - Please help

2009-09-07 Thread newb.py
I am trying to learn NLP with Python and am getting the following error when trying to do an import statement: >>> import nltk >>> import re >>> from nltk_lite.utilities import re_show Traceback (most recent call last): File "", line 1, in ImportError: No module named nltk_lite.utilities I hav

Re: How to debug this import problem?

2009-05-11 Thread Iwan
Mmm, we solved half of the cause of this one. Test runs are kicked off via setuptools's test command. But this happens programmatically, and successively in one process. But setuptools's test command clears all modules imported during a test run from sys.modules - hence it is intended that module

Re: How to debug this import problem?

2009-05-09 Thread Iwan
Hi Scott, Diez, On May 8, 8:21 pm, Scott David Daniels wrote: > Diez B. Roggisch wrote: > > Try putting an "import pdb; pdb.set_trace()" on top of the decimal module. [snip] > You can also run Python with the "-v" or "-vv" flags to get output > about exactly what files are getting imported from t

Re: How to debug this import problem?

2009-05-08 Thread Scott David Daniels
Diez B. Roggisch wrote: Iwan Vosloo wrote: We have a rather complicated program which does a bit of os.chdir and sys.path manipulations. In between all of this, it imports the decimal module several times However, it imports a new instance of decimal sometimes. (Which is a problem, since a

Re: How to debug this import problem?

2009-05-08 Thread Diez B. Roggisch
Iwan Vosloo wrote: > Hi there, > > We have a rather complicated program which does a bit of os.chdir and > sys.path manipulations. In between all of this, it imports the decimal > module several times. > > However, it imports a new instance of decimal sometimes. (Which is a > problem, since a

How to debug this import problem?

2009-05-08 Thread Iwan Vosloo
Hi there, We have a rather complicated program which does a bit of os.chdir and sys.path manipulations. In between all of this, it imports the decimal module several times. However, it imports a new instance of decimal sometimes. (Which is a problem, since a decimal.Decimal (imported at point A

Re: Embedded Python Import problem

2008-06-27 Thread Benjamin
On Jun 27, 5:47 pm, sleek <[EMAIL PROTECTED]> wrote: > I am having trouble with the following code: > > PyObject *module = PyImport_ImportModule(modulename); > if (module == NULL) { > >     PyObject* et, *ev, *etr; >     PyErr_Fetch(&et, &ev, &etr); >     PyObject* traceback = PyImport_ImportModule

Embedded Python Import problem

2008-06-27 Thread sleek
I am having trouble with the following code: PyObject *module = PyImport_ImportModule(modulename); if (module == NULL) { PyObject* et, *ev, *etr; PyErr_Fetch(&et, &ev, &etr); PyObject* traceback = PyImport_ImportModule("traceback"); PyObject* tb = PyObject_CallMethodObjArgs(traceb

Re: module import problem

2008-05-25 Thread Milos Prudek
> Reinstall the package "python-gnupginterface" with "sudo aptitude reinstall Your advice helped! Upgrade is running now. Thanks! -- Milos Prudek -- http://mail.python.org/mailman/listinfo/python-list

Re: module import problem

2008-05-24 Thread Matt Nordhoff
Milos Prudek wrote: > I have a Kubuntu upgrade script that fails to run: > > File "/tmp/kde-root//DistUpgradeFetcherCore.py", > line 34, in > import GnuPGInterface > ImportError > No module named GnuPGInterface > > I got a folder /usr/share/python-support/python-gnupginterface with > a "GnuPGI

Re: module import problem

2008-05-24 Thread Sebastian 'lunar' Wiesner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 [ Milos Prudek <[EMAIL PROTECTED]> ] > If I cd into /usr/share/python-support/python-gnupginterface and launch > Python I can "import GnuPGInterface". But when I run > DistUpgradeFetcherCore.py in that folder it always fails with No module > named Gnu

module import problem

2008-05-24 Thread Milos Prudek
I have a Kubuntu upgrade script that fails to run: File "/tmp/kde-root//DistUpgradeFetcherCore.py", line 34, in import GnuPGInterface ImportError No module named GnuPGInterface I got a folder /usr/share/python-support/python-gnupginterface with a "GnuPGInterface.py" but no __init__.py. In pyt

Re: Weird import problem

2008-05-05 Thread Anton81
>> NS/dir1/file1.py >> NS/dir2/file2.py > This *must* be wrong or at least not the full directory listing - please > read It is the directory structure in one of the python paths. > Missing __init__.py in the dir2? Oh right. I forgot about this. Thank you! -- http://mail.python.org/mailman/listinf

Re: Weird import problem

2008-05-04 Thread Diez B. Roggisch
Anton81 schrieb: I have a directory structure like NS/dir1/file1.py NS/dir2/file2.py This *must* be wrong or at least not the full directory listing - please read http://docs.python.org/tut/node8.html if in the python shell I type import NS.dir1.file1 it works, however typing import N

Weird import problem

2008-05-04 Thread Anton81
I have a directory structure like NS/dir1/file1.py NS/dir2/file2.py if in the python shell I type import NS.dir1.file1 it works, however typing import NS.dir2.file2 fails with ImportError: No module named dir2.file2 Any ideas what could go wrong? Directory permissions seem to be OK. -- htt

import problem in zope

2007-12-05 Thread jack139
I installed zope under windows and found a problem when import addition modules - iHotfix and itools. When place itools in python's library path, site-packages, import works fine. When place itools in zope-instance's library path, /zope-instance/lib/python, it seems the the import only work partial

Re: Circular import problem

2007-07-15 Thread Alex Popescu
On Jul 15, 10:08 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sun, 15 Jul 2007 08:49:54 -0300, Alex Popescu > <[EMAIL PROTECTED]> escribió: > > > > >> > But, I still don't understand how python can access a function in a > >> > file I have NOT included. In this case, to get things to w

Re: Circular import problem

2007-07-15 Thread Gabriel Genellina
En Sun, 15 Jul 2007 08:49:54 -0300, Alex Popescu <[EMAIL PROTECTED]> escribió: >> > But, I still don't understand how python can access a function in a >> > file I have NOT included. In this case, to get things to work, I DO >> > NOT "import MMA.grooves" but later in the module I access a functi

Re: Circular import problem

2007-07-15 Thread Alex Popescu
On Jul 14, 6:27 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 13 Jul 2007 13:24:57 -0300, bvdp <[EMAIL PROTECTED]> escribió: > > > > > > >> Seehttp://effbot.org/zone/import-confusion.htm > >> Try to move the circular references later in the code (maybe inside a > >> function, when it

Re: Circular import problem

2007-07-14 Thread Gabriel Genellina
En Sat, 14 Jul 2007 14:44:05 -0300, bvdp <[EMAIL PROTECTED]> escribió: >> > But, I still don't understand how python can access a function in a >> > file I have NOT included. In this case, to get things to work, I DO >> > NOT "import MMA.grooves" but later in the module I access a function >> > wi

Re: Circular import problem

2007-07-14 Thread greg
bvdp wrote: > before I moved other > imports around I was able to do the following: > > 1. NOT include MMA.gooves, > 2. call the function MMA.grooves.somefunc() > > and have it work. The import doesn't necessarily have to be in the same module where the attribute is used. The first time *any*

Re: Circular import problem

2007-07-14 Thread bvdp
> > But, I still don't understand how python can access a function in a > > file I have NOT included. In this case, to get things to work, I DO > > NOT "import MMA.grooves" but later in the module I access a function > > with "xx=MMA.grooves.somefunc()" and it finds the function, and works > > jus

Re: Circular import problem

2007-07-13 Thread Gabriel Genellina
En Fri, 13 Jul 2007 13:24:57 -0300, bvdp <[EMAIL PROTECTED]> escribió: > >> Seehttp://effbot.org/zone/import-confusion.htm >> Try to move the circular references later in the code (maybe inside a >> function, when it is required), or much better, refactor it so there is >> no >> circularity. >>

Re: Circular import problem

2007-07-13 Thread bvdp
Just as a bit of a followup, I have fixed the problem in my code. I changed the order of some of the imports in some other modules. What I was doing was more guesswork and good luck ... but it works. I really wonder if there is a better way to figure these problems out. Reading a few of the other

Re: Circular import problem

2007-07-13 Thread bvdp
> Seehttp://effbot.org/zone/import-confusion.htm > Try to move the circular references later in the code (maybe inside a > function, when it is required), or much better, refactor it so there is no > circularity. > > -- > Gabriel Genellina Yes, thanks. I'd read that page before posting. Helpful.

Re: Circular import problem

2007-07-12 Thread Gabriel Genellina
En Thu, 12 Jul 2007 23:36:16 -0300, bvdp <[EMAIL PROTECTED]> escribió: > I'm going quite nutty here with an import problem. I've got a fairly > complicated program (about 12,000 lines in 34 modules). I just made > some "improvements" and get the following er

Circular import problem

2007-07-12 Thread bvdp
I'm going quite nutty here with an import problem. I've got a fairly complicated program (about 12,000 lines in 34 modules). I just made some "improvements" and get the following error: bob$ mma Traceback (most recent call last): File "/usr/local/bin/mma", li

Re: file / module / package - import problem

2007-05-31 Thread EuGeNe Van den Bulke
aspineux wrote: > import os.path > > file=open(os.path.join(os.path.dirname(__file__), 'hauteur.yaml')) Thanks that worked ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: file / module / package - import problem

2007-05-30 Thread aspineux
The filename and its path is in global variable __file__ (that is different in any source file) try import os.path file=open(os.path.join(os.path.dirname(__file__), 'hauteur.yaml')) On 30 mai, 22:22, EuGeNe Van den Bulke <[EMAIL PROTECTED]> wrote: > Hi there, > > I have a "problem" which co

file / module / package - import problem

2007-05-30 Thread EuGeNe Van den Bulke
Hi there, I have a "problem" which could be a bad design on my behalf but I am not sure so ... I have a package WMI which contains a module hauteur.py which, when imported, load data from a file located in WMI/data/. In hauteur.py I call open('data/hauteur.yaml'). test.py WMI/ hauteur.py

relative import problem

2007-04-27 Thread Alan Isaac
I'm new to relative imports and having a problem. (ValueError: Attempted relative import in non-package) I noticed this: http://www.thescripts.com/forum/thread549516.html Is this behavior intentional? I'm seeing it in Python 2.5.1. Thanks, Alan Isaac -- http://mail.python.org/mailman/listinfo/

Re: Relative import problem

2007-04-19 Thread Martin
On Apr 19, 6:54 pm, "Jorgen Bodde" <[EMAIL PROTECTED]> wrote: > Hi all, > > I want to structure my app so that I have two dirs like; > > obj/{object files} > > gui/{gui files} > > Here comes the catch. From the GUI dir, I would like to access the obj > submodule path. I need to go one dir back.. I

Re: Relative import problem

2007-04-19 Thread kyosohma
On Apr 19, 11:54 am, "Jorgen Bodde" <[EMAIL PROTECTED]> wrote: > Hi all, > > I want to structure my app so that I have two dirs like; > > obj/{object files} > > gui/{gui files} > > Here comes the catch. From the GUI dir, I would like to access the obj > submodule path. I need to go one dir back.. I

Relative import problem

2007-04-19 Thread Jorgen Bodde
Hi all, I want to structure my app so that I have two dirs like; obj/{object files} gui/{gui files} Here comes the catch. From the GUI dir, I would like to access the obj submodule path. I need to go one dir back.. I read there was something like from .. import x in python 2.5 so that I could a

gdesklets question: import problem

2007-02-01 Thread Flavio
Hi, sorry for posting here, but the forum in the projects page is not working. Maybe there is a gdesklet developer lurking... :-) I cant import anything from a script, it gives me a runtime error. is this a bug or a feature? without being able to import from python standard library or other mo

Re: Strange xml.parsers.expat import problem [corrected subject]

2006-10-03 Thread [EMAIL PROTECTED]
I was able to fix (i.e., work around) this issue by using the import: import xml.parsers.expat as expat and then referring to: expat.ExpatError I have no idea why this makes it work, seems like a bug in Python to me. -Don [EMAIL PROTECTED] wrote: > Sorry, that should have been "xml.parsers.e

Strange xml.parsers.expat import problem [corrected subject]

2006-09-15 Thread [EMAIL PROTECTED]
Sorry, that should have been "xml.parsers.expat" [EMAIL PROTECTED] wrote: > Hi, c.l.p.'ers- > > I am having a problem with the import of xml.parsers.expat that has > gotten me completely stumped. I have two programs, one a PyQt program > and one a command line (text) program that both eventually c

Strange xml.parsers.xml import problem

2006-09-15 Thread [EMAIL PROTECTED]
Hi, c.l.p.'ers- I am having a problem with the import of xml.parsers.expat that has gotten me completely stumped. I have two programs, one a PyQt program and one a command line (text) program that both eventually call the same code that imports xml.parsers.expat. Both give me different results...

Re: circular import problem

2005-09-09 Thread Terry Reedy
"Learning Python" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > An example in the book I didn't understood well > two modules files recursively import/from each other There are past postings available in the archives (via Google) at least, that lucided discuss circular imports.

circular import problem

2005-09-09 Thread Learning Python
An example in the book I didn't understood well two modules files recursively import/from each other in recur1.py,we have: x=1 import recur2 y=1 in recur2.py, we have from recur1 import x from recur1 import y If we run interactively at python command line, >>> import recur1 it has errors li

Re: subpackage import problem

2005-08-24 Thread Eric Huss
On Sun, 21 Aug 2005, Robert Kern wrote: > Eric Huss wrote: > > I'm having a problem with packages within packages. Here's an example: > > > > foo/ > > foo/__init__.py: empty file > > foo/sub/__init__.py: > > from foo.sub.B import B > > foo/sub/A.py: > > class A: > > pass > > f

Re: subpackage import problem

2005-08-21 Thread Robert Kern
Eric Huss wrote: > I'm having a problem with packages within packages. Here's an example: > > foo/ > foo/__init__.py: empty file > foo/sub/__init__.py: > from foo.sub.B import B > foo/sub/A.py: > class A: > pass > foo/sub/B.py > import foo.sub.A > class B(foo

subpackage import problem

2005-08-21 Thread Eric Huss
I'm having a problem with packages within packages. Here's an example: foo/ foo/__init__.py: empty file foo/sub/__init__.py: from foo.sub.B import B foo/sub/A.py: class A: pass foo/sub/B.py import foo.sub.A class B(foo.sub.A): pass

Re: Zope, Python 2.4 pythonScripts import problem

2005-08-17 Thread William Heymann
On Tuesday 16 August 2005 07:09 am, [EMAIL PROTECTED] wrote: > I see that Python 2.4.x does not work with Zope-2-7-6 properly. When I > start zope I get warning that I should recompile my pythonScripts by > executing manage_addProduct/PythonScripts/recompile. I do it and get > list of scripts whoos

Re: Zope, Python 2.4 pythonScripts import problem

2005-08-16 Thread krzychu
I see that Python 2.4.x does not work with Zope-2-7-6 properly. When I start zope I get warning that I should recompile my pythonScripts by executing manage_addProduct/PythonScripts/recompile. I do it and get list of scripts whoose were compiled but when I repeat that action I get the same list of

  1   2   >