Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
Hi! I'm learning python in conjunction with zope/plone and I would like
to use eclipse/pydev because of it's greate features. The major problem
I have is that each time i start a python run the console tells me for
example "ImportError: No module named Products.MyProduct.config" which
is triggered by the corresponding "from Products.MyProduct.config import *".
Similar happens if I try to import something from Products.CMFCore.utils for
I tried to modify the Projects PYTHONPATH the way I added `$INSTANCE`/Products
and, as an alternative, only `$INSTANCE`. Also I tried to place the
`$INSTANCE`/Prodcts directory in a source folder beneath the project but without
I would like to know if I make a general mistake and how I can overcome.
Thank you very much.
Have you already checked the getting started manual on how to configure your project pythonpath? (http://fabioz.com/pydev/manual_101_root.html)
I don't have import errors, but the code completion did not work at first, due to a peculiarity of Zope: All products are added to the 'Products' packet namespace, so you cannot simply add a product to the PYTHONPATH. To cite the zope.conf file (products directive):
"Each directory identified will be added to the __path__ of the Products package. All Products are initialized in ascending alphabetical order by product name. If two products with the same name exist in two Products directories, the order in which the packages appear here defines the load order. The master Products directory exists in Zope's software home, and cannot be removed from the products path (and should not be added to it here)."
One workaround for Pydev is to add a Products folder that contains the actual products, the Products folder does not need to contain an __init__.py to be recognized as a Python package by Pydev. The parent of the Products folder must be added to the PYTHONPATH. Note: You need to clean (and rebuild) the project to get the code completion to work.
A better solution would be the ability to add a package prefix to each python path source folder. For Zope/Plone products the prefix would then be 'Products'. Is that possible Fabio?