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