Re: [Zope] external method import error (ImportError)...

2000-10-07 Thread Dieter Maurer

Eric writes:
  To summarize: How do I import modules in an External Method's .py file?
I remember, I read this in some "External Method" related documentation.

You do *NOT* place such modules inside the folder "Extensions"
but put them somewhere else reachable by "PYTHONPATH".

The documentation suggests that you create a subpackage inside
"Shared", say "myCompanyExtensions", and place there
your module (don't forget "__init__.py" in the subfolder
representing the subpackage), say "myModule".

Then, in your external method, you would use:

from Shared.myCompanyExtensions import myModule


Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] external method import error (ImportError)...

2000-10-04 Thread Eric

Hi,

To summarize: How do I import modules in an External Method's .py file?

I have an external method that points to a .py file that has an import
statement at the top.  The import statement loads another module of mine
(CProject.py).  I've placed both files (pwToxml.py and CProject.py) in the
Zope/Extensions directory.  When I try to create an external method on the
pTox.py file with the following parameters:
ID = pTox
Function Name = pTox
Python Module File = pwToxml
I get the following error:
Error Type: ImportError
Error Value: No module named CProject
Traceback (innermost last):
  File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line 222, in
publish_module
  File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line 187, in
publish
  File /usr/local/Zope/lib/python/Zope/__init__.py, line 221, in
zpublisher_exception_hook
  File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line 171, in
publish
  File /usr/local/Zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
(Object: manage_addExternalMethod)
  File /usr/local/Zope/lib/python/ZPublisher/Publish.py, line 112, in
call_object
(Object: manage_addExternalMethod)
  File /usr/local/Zope/lib/python/Products/ExternalMethod/ExternalMethod.py,
line 130, in manage_addExternalMethod
  File /usr/local/Zope/lib/python/Products/ExternalMethod/ExternalMethod.py,
line 178, in __init__
(Object: pTox)
  File /usr/local/Zope/lib/python/Products/ExternalMethod/ExternalMethod.py,
line 201, in manage_edit
(Object: pTox)
  File /usr/local/Zope/lib/python/Products/ExternalMethod/ExternalMethod.py,
line 210, in getFunction
(Object: pTox)
  File /usr/local/Zope/lib/python/App/Extensions.py, line 217, in getObject
(Info: ('/usr/local/Zope/Extensions/pwToxml.py', 'pwToxml'))
  File /usr/local/Zope/Extensions/pwToxml.py, line 1, in ?
ImportError: (see above)

I checked the sys.path for my Python installation and placed the CProject.py
file there, but I still get the same error.

Here's the top of my pwToxml.py file:

import CProject, string

def pTox(self, REQUEST):
"""Function to map pw to CProject Objects"""
P=CProject.CProject()
dictData = REQUEST.form.items()
strTemp = ""
strError = "Error Retrieving Dictionary Value"
...etc...

Thanks for any help you can provide.


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )