Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-discussion] Setting sys.path in Protege Script Tab using Python

Jonathan Carter jonathan.carter at e-asolutions.com
Wed Oct 22 05:18:58 PDT 2008


I've been having a lot of trouble with setting the classpath /  
pythonpath in the Script Tab - but only on Windows XP / 2003 Server.

I want to import some of the Protege Standard Extension classes in my  
Python script and have used the documented approach following the  
Script Tab wiki and the standard Python approach for dynamically  
adding to the class path, as follows:

import sys
sys.path.append("plugins/edu.stanford.smi.protegex.standard_extensions/ 
standard-extensions.jar")

This works very nicely on Mac OS/X and then I can import classes from  
that Jar.

However, when I ran the same script on Windows, it fails to set the  
class/python path and the imports fail. I've tried setting the  
python.path property in the Lax properties in Protege which has the  
same effect as the sys.path.append - the path is defined but does not  
seem to be picked up by the Jython environment.
The only way I could get it to import this Jar was to explicitly add  
it to the class.path property in the Lax properties. However, this  
messed up several of the tabs and can't be used.
I've tried all kinds of variations of defining the path to take  
account of Windows' quirks but to no avail.

Has anyone managed to get the sys.path.append() to work on Windows?
It seems like it just isn't updating the classpath as it should.
 From the source code, it looks like an issue with the underlying  
Jython implementation rather than the tab itself unless I'm missing  
something.

Thanks

Jonathan
_______________________________________

Jonathan Carter - Head of Technical Architecture
Enterprise Architecture Solutions Ltd
Web: www.enterprise-architecture.com
_______________________________________

Assess your EA maturity at:
www.enterprise-architecture.com/EAvaluator
_______________________________________

W O R L D    C L A S S    A R C H I T E C T U R E

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-discussion/attachments/20081022/7a0d5912/attachment.html>


More information about the protege-discussion mailing list