[Eric] using eric4 to debug django project

Detlev Offenbach detlev at die-offenbachs.de
Tue Jan 1 10:22:46 GMT 2008


Hi Jake,

thanks for your lengthy explanations. I'll have a look into eric4 and will 
report back. I think, that the problem can (and will) be fixed.

Detlev

On Montag, 31. Dezember 2007, Jake B wrote:
> I created a simple, representative example that shows what is going wrong.
>
> I created a project with directory structure as follows:
>
> /test_workspace
>
> >     /packageOne
> >        __init__.py
> >        moduleOne.py
> >     /packageTwo
> >        __init__.py
>
> moduleOne.py is a one-liner:
>
> import packageTwo
>
>
> I opened moduleOne and told it to run in test_workspace. It broke on the
> import, and I interactively debugged it.
>
> Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32)
>
> > [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on
> > jacob-laptop, Standard
> >
> > >>> import packageTwo
> >
> > Traceback (innermost last):
> >   File "<stdin>", line 1, in <module>
> > ImportError: No module named packageTwo
> >
> > >>> import sys,os,os.path as p
> > >>> sys.path
> >
> > [u'/home/jacob/test_workspace/packageOne',
> > '/usr/lib/python2.5/site-packages/eric4/DebugClients/Python',
> > '/usr/lib/python25.zip', '/usr/lib/python2.5',
> > '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk',
> > '/usr/lib/python2.5/lib-dynload',
> > '/usr/local/lib/python2.5/site-packages',
> > '/usr/lib/python2.5/site-packages',
> > '/usr/lib/python2.5/site-packages/Numeric',
> > '/var/lib/python-support/python2.5',
> > '/var/lib/python-support/python2.5/gtk- 2.0']
> >
> > >>> p.realpath(p.curdir)
> >
> > '/home/jacob/test_workspace'
> >
> > >>> sys.path = sys.path + ['']
> > >>> sys.path
> >
> > [u'/home/jacob/test_workspace/packageOne',
> > '/usr/lib/python2.5/site-packages/eric4/DebugClients/Python',
> > '/usr/lib/python25.zip', '/usr/lib/python2.5',
> > '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk',
> > '/usr/lib/python2.5/lib-dynload',
> > '/usr/local/lib/python2.5/site-packages',
> > '/usr/lib/python2.5/site-packages',
> > '/usr/lib/python2.5/site-packages/Numeric',
> > '/var/lib/python-support/python2.5',
> > '/var/lib/python-support/python2.5/gtk- 2.0', '']
> >
> > >>> import packageTwo
>
> So it worked after I added the empty path ('') to eric's pythonpath.
>
> Please note that my path in my ordinary system python interpreter is as
> follows:
>
> ['', '/usr/lib/python25.zip', '/usr/lib/python2.5',
>
> > '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk',
> > '/usr/lib/python2.5/lib-dynload',
> > '/usr/local/lib/python2.5/site-packages',
> > '/usr/lib/python2.5/site-packages',
> > '/usr/lib/python2.5/site-packages/Numeric',
> > '/var/lib/python-support/python2.5',
> > '/var/lib/python-support/python2.5/gtk- 2.0']
>
> Note that it contains the empty path. When I start the system python
> interpreter in test_workspace, I am able to import packageTwo correctly.
>
> Conclusions:
>
>    1. Eric uses a different pythonpath than the one on my system, and
>    excludes some paths from it. In this case, it is the empty path ('').
>    2. For some reason, the empty path is necessary to import packages
>    that are in the current working directory. I didn't know this, but I
> guess that's how it works.
>    3. Because eric excludes the empty path, it is impossible for modules
>    created in packages created in the same directory to import one-another.
>
> I'm not sure if I should file this should be filed as a bug-report, or if
> this is simply a matter of configuring the pythonpath used by eric.
> However, I wasn't able to find a way to configure eric's pythonpath.
> I guess it's also possible that this is a regression in a recent snapshot
> (I'm using eric4 4.1-snapshot20071224).
> I'd greatly appreciate any guidance anyone could offer.
> Much thanks.
>
> Jake
>
> On Dec 30, 2007 3:28 PM, Evren Esat Özkan <sleytr at gmail.com> wrote:
> > But you don't have to. You can import modules from packages located in
> > same folder with your script.
> > As I said before, I removed django from site-packages and relocated to
> > the project folder and it worked.
> > I can't imagine any cause for your problem but I think it can't be
> > related with pythonpath and/or eric's default settings.
> > May be you should try a clean install of eric4 with a simple test script.
> > (two modules importing one to other.)
> >
> > On Sun, 30 Dec 2007 22:12:31 +0200, Jake B <otakuj462 at gmail.com> wrote:
> > > Tricky.
> > > I guess maybe the best way to deal this, then is to symlink everything
> >
> > in
> >
> > > site-packages.
> > > If anyone has any ideas about how else to do this, please let me know.
> > > Thanks.
> > >
> > > Jake
> > >
> > > On Dec 30, 2007 3:08 PM, Evren Esat Özkan <sleytr at gmail.com> wrote:
> > >> It's sym.linked to site-packages. But just for testing I moved that
> >
> > link
> >
> > >> to the project folder and it worked again.
> > >>
> > >> On Sun, 30 Dec 2007 21:53:38 +0200, Jake B <otakuj462 at gmail.com> wrote:
> > >> > Is your django package installed locally as part of the project, or
> > >> > globally
> > >> > in someplace like /usr/lib?
> > >> > Please let me know. Thanks.
> > >> >
> > >> > Jake
> > >> >
> > >> > On Dec 30, 2007 2:34 PM, Evren Esat Özkan <sleytr at gmail.com> wrote:
> > >> >> Hi,
> > >> >>
> > >> >> I'm using eric for Django based web development for last four
> > >> >> months
> > >>
> > >> but
> > >>
> > >> >> never used it's debugging features. I'm not using eric's shell too
> > >> >>  (`manage.py shell` with ipython is  enough for me)
> > >> >>
> > >> >> But I'm just tried to run one of my projects via running manage.py
> > >>
> > >> with
> > >>
> > >> >> `runserver` argument and it succesfuly started  the server then
> > >>
> > >> printed
> > >>
> > >> >> all
> > >> >> output to the shell.
> > >> >>
> > >> >> On 12/30/07, Jake B <otakuj462 at gmail.com> wrote:
> > >> >> > I'm getting a bit confused now, because I've added my eric
> > >>
> > >> workspace
> > >>
> > >> >> to
> > >> >>
> > >> >> > my PYTHONPATH, and can import all the modules in my eric
> > >> >> > workspace
> > >> >>
> > >> >> from the
> > >> >>
> > >> >> > python interpreter run from any directory on my system, but when
> > >>
> > >> run
> > >>
> > >> >> from
> > >> >>
> > >> >> > within eric, the modules still cannot import one-another. Also,
> >
> > the
> >
> > >> >> eric
> > >> >>
> > >> >> > python interpreter shell cannot import these modules, even though
> > >> >>
> > >> >> they are
> > >> >>
> > >> >> > part of my project, and on my global PYTHONPATH.
> > >> >> > Is there a best-practices way of making visible python packages
> > >>
> > >> that
> > >>
> > >> >> are
> > >> >>
> > >> >> > in the same directory and sharing the same project? If not, is
> > >>
> > >> there
> > >>
> > >> >> a way
> > >> >>
> > >> >> > to at least troubleshoot eric to determine what it is using for
> >
> > its
> >
> > >> >> > PYTHONPATH?
> > >> >> > Please let me know. Thanks.
> > >> >> >
> > >> >> > Jake
> > >> >> >
> > >> >> > On Dec 30, 2007 11:42 AM, Jake B < otakuj462 at gmail.com> wrote:
> > >> >> > > PyDev has this feature. When you make a new project, it
> > >> >>
> > >> >> automatically
> > >> >>
> > >> >> > > configures your PYTHONPATH for that project. It also gives you
> > >> >> > > a
> > >> >>
> > >> >> graphical
> > >> >>
> > >> >> > > way of adding additional paths to PYTHONPATH, and configuring
> > >> >>
> > >> >> PYTHONPATH to
> > >> >>
> > >> >> > > reference other projects in the workspace. This makes things
> >
> > much
> >
> > >> >> easier.
> > >> >>
> > >> >> > > Perhaps I could put this in as a feature request.
> > >> >> > >
> > >> >> > > Jake
> > >> >> > >
> > >> >> > > On Dec 30, 2007 7:45 AM, Flavio Coelho < fccoelho at gmail.com >
> > >>
> > >> wrote:
> > >> >> > > > Hi Jake,
> > >> >> > > >
> > >> >> > > > As far as I know Eric does
> > >> >> > > > not adds project folders to the Python (though it would be an
> > >> >>
> > >> >> interesting feature)
> > >> >>
> > >> >> > > > What I do in my development directories, when I want to
> > >> >> > > > import
> > >> >>
> > >> >> from
> > >> >>
> > >> >> > > > a package sitting elsewhere (which I don't want to install
> > >> >>
> > >> >> globally), is to
> > >> >>
> > >> >> > > > add a symlink to it to a directory where it will be visible
> > >> >> > > > to
> > >> >>
> > >> >> scripts
> > >> >>
> > >> >> > > > wanting to import it.
> > >> >> > > >
> > >> >> > > > it is simple and it works for me without having to move or
> >
> > copy
> >
> > >> >> > > > source files.
> > >> >> > > >
> > >> >> > > > Flávio
> > >> >> > > >
> > >> >> > > > On 12/29/07, Jake B < otakuj462 at gmail.com> wrote:
> > >> >> > > > > Hi,
> > >> >> > > > > I'm trying to use eric4 to debug a django project. To do
> > >>
> > >> this,
> > >> I
> > >>
> > >> >> > > > > have django checked out of svn, as well as my application
> > >> >>
> > >> >> files, and they
> > >> >>
> > >> >> > > > > are all sharing the same workspace. I have directory
> > >>
> > >> structure
> > >>
> > >> >> that looks
> > >> >>
> > >> >> > > > > like this:
> > >> >> > > > >
> > >> >> > > > > workspace_eric/
> > >> >> > > > >     django/
> > >> >> > > > >         bin/
> > >> >> > > > >         ...
> > >> >> > > > >         __init__.py
> > >> >> > > > >     fbproject/
> > >> >> > > > >         fbapp/
> > >> >> > > > >            __init__.py
> > >> >> > > > >            models.py
> > >> >> > > > >            urls.py
> > >> >> > > > >            views.py
> > >> >> > > > >         __init.py__
> > >> >> > > > >         manage.py
> > >> >> > > > >         settings.py
> > >> >> > > > >         urls.py
> > >> >> > > > >
> > >> >> > > > > Unfortunately, my modules in fbproject package cannot
> > >> >> > > > > import
> > >>
> > >> my
> > >>
> > >> >> > > > > modules in django package, so when I try to start the
> > >> >> > > > > server
> > >>
> > >> by
> > >>
> > >> >> running
> > >> >>
> > >> >> > > > > fbproject/manage.py, giving it the command line argument *
> > >> >> > > > > runserver*, and the working directory
> > >> >>
> > >> >> /home/jacob/workspace_eric,
> > >> >>
> > >> >> > > > > it throws an error. Is eric supposed to configure my
> > >>
> > >> PYTHONPATH
> > >>
> > >> >> for me? If
> > >> >>
> > >> >> > > > > so, could anyone please let me know what I'm missing?
> > >> >> > > > > Thanks.
> > >> >> > > > >
> > >> >> > > > > Jake
> > >> >> > > > >
> > >> >> > > > > _______________________________________________
> > >> >> > > > > Eric mailing list
> > >> >> > > > > Eric at riverbankcomputing.com
> > >> >> > > > > http://www.riverbankcomputing.com/mailman/listinfo/eric
> > >> >> > > >
> > >> >> > > > --
> > >> >> > > > Flávio Codeço Coelho
> > >>
> > >> ----------------------------------------------------------------
> > >>
> > >> >> > > > "My grandfather once told me that there were two kinds of
> > >>
> > >> people:
> > >> >> > > > those who do the work and those who take the credit. He told
> >
> > me
> >
> > >> >> to try to be
> > >> >>
> > >> >> > > > in the first group; there was much less competition."
> > >> >> > > > Indira Gandhi
> > >> >> > > > ====================================
> > >> >> > > > registered Linux user # 386432
> > >> >> > > > get counted at http://counter.li.org
> > >>
> > >> ----------------------------------------------------------------
> > >>
> > >> >> > _______________________________________________
> > >> >> > Eric mailing list
> > >> >> > Eric at riverbankcomputing.com
> > >> >> > http://www.riverbankcomputing.com/mailman/listinfo/eric
> > >> >>
> > >> >> --
> > >> >> Evren Esat ÖZKAN
> > >> >> esat.ozkan at asyanet.com
> > >>
> > >> --
> > >> Evren Esat Özkan
> >
> > --
> > Evren Esat Özkan



-- 
Detlev Offenbach
detlev at die-offenbachs.de



More information about the Eric mailing list