Re: [Zope] problem with adding an external method

2005-08-24 Thread Dieter Maurer
Scott Mann wrote at 2005-8-23 10:00 -0700:
 ...
I am attempting to add the external python module nb_fetch Doing so returns 
the error message:

Module /data/zope/testbed/initialzope/Extensions/nb_fetch.py, line 3, in ?

 ImportError: No module named nb_parse

where nb_parse is imported by nb_fetch.

Note that Zope does not use Python's normal import mechanism
to load the source file for External Methods.
One impact: you cannot use relative imports:

   Even if nb_fetch.py and nb_parse.py lie side by side in
   the same folder, nb_fetch.py cannot simple do
   an import nb_parse to access the other module.

 ...
I have also made a number of attempts at adding directories to the PYTHONPATH, 
but no success.

If nb_parse.py is in a folder listed in PYTHONPATH,
the import nb_parse should succeed.

 ...
Also, I restart zope every time I make a change.

Change what?

If you change the source file of an External Method *AND*
you run your Zope in development mode, then changes are
recognized automatically.

Chances in other Python modules (such as your nb_parse above)
require a Zope restart.

-- 
Dieter
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] problem with adding an external method

2005-08-23 Thread Scott Mann

Hi All,

Sorry in advance for this newbie question. I've searched the archives and while 
I have learned a few things and tried a few things, I still have the same 
problem.

I am attempting to add the external python module nb_fetch Doing so returns 
the error message:

Module /data/zope/testbed/initialzope/Extensions/nb_fetch.py, line 3, in ?

 ImportError: No module named nb_parse

where nb_parse is imported by nb_fetch. I have tried adding __init__.py into 
the Extensions directory. I have also made a number of attempts at adding 
directories to the PYTHONPATH, but no success. I have even put the imported 
modules (nb_parse, etc) into the lib/python subdirectory of the zope directory. 
Also, I restart zope every time I make a change. Any ideas?

TIA
Scott
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] problem with adding an external method

2005-08-23 Thread Jonathan


- Original Message - 
From: Scott Mann [EMAIL PROTECTED]
Sorry in advance for this newbie question. I've searched the archives and 
while I have learned a few things and tried a few things, I still have the 
same problem.


I am attempting to add the external python module nb_fetch Doing so 
returns the error message:


   Module /data/zope/testbed/initialzope/Extensions/nb_fetch.py, line 3, 
in ?


ImportError: No module named nb_parse

where nb_parse is imported by nb_fetch. I have tried adding __init__.py 
into the Extensions directory. I have also made a number of attempts at 
adding directories to the PYTHONPATH, but no success. I have even put the 
imported modules (nb_parse, etc) into the lib/python subdirectory of the 
zope directory. Also, I restart zope every time I make a change. Any 
ideas?


Zope is unable to add the external method because there is a python error 
('No module named nb_parse') which stops zope from loading the external 
method.  Two possible fixes:


1) set your path to include the directory where nb_parse.py lives.
eg.
   import sys
   sys.path.append('/apps/zope/lib/python/mypythonroutines')

Also, make sure the group/ownership of the directory and python routine 
files allow zope to access them.


2) try 'hardcoding' the nb_parse routine within nb_fetch.py.   If this 
works, then your problem is definitely related to pythonpath not being set 
up (or zope can't access the directories/files in the path).


hth

Jonathan



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )