[Zope] Import classes in External method

2000-08-16 Thread Francois-Regis CHALAOUX

Hi,

How to import classes in an External method?

I mean, where to place the module where my class is defined. I tried to put it
in "lib/python/" or "Zope-2-2-0/lib/python/Shared", or in
"/usr/lib/python1.5/" but I always got the same message : 


The errror
===

Error Type: SystemError/STRONGBR
Error Value: Failed to import class myclass from module __main__ 

mycode
==

import module_of_class

def useClass(self):
foo = module_of_class.myclass()


Bye, FR.
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 

___
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 )




Re: [Zope] Import classes in External method

2000-08-16 Thread Dieter Maurer

Francois-Regis CHALAOUX writes:
  How to import classes in an External method?
  
  I mean, where to place the module where my class is defined. I tried to put it
  in "lib/python/" or "Zope-2-2-0/lib/python/Shared", or in
  "/usr/lib/python1.5/" but I always got the same message : 
  
  
  The errror
  ===
  
  Error Type: SystemError/STRONGBR
  Error Value: Failed to import class myclass from module __main__ 

Strange!
When you place your module in "lib/python" (or any other
directory listed in PYTHONPATH), then "import module"
should work.

When you place it in "lib/python/Shared", you need
"from Shared import module".


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 )