Jason,

 

If I have my own library, that I’d usually point at through a .pth file in the site-packages directory, should I point to it through the python.path environment var?

 

I’ve just tried using the code sample below and it failed...

 

 

john

 

From: Jason R Briggs [mailto:jasonrbriggs@gmail.com]
Sent: 02 November 2009 09:22
To: Baker, John (IT/UK); jython-users@lists.sourceforge.net
Subject: Re: [Jython-users] from and with keywords

 

If you're deploying in a war, then stick the Lib directory in the "classes" dir (for example), and then point the python path at that directory with something vaguely like:

Properties props = new Properties();
String jythonPath = libDir.getFile().getCanonicalPath();
props.put("python.path", jythonPath);
PythonInterpreter.initialize(System.getProperties(), props, null);

In my case, "libDir" is a prop injected by spring:

<property name="libDir" value="classpath:Lib" />

So you'll need to grab the canonical path according to whatever framework you're working within.

Dunno if that helps?

J



This e-mail (including any attachments) is confidential, may contain
proprietary or privileged information and is intended for the named
recipient(s) only. Unintended recipients are prohibited from taking action
on the basis of information in this e-mail and must delete all copies.
Nomura will not accept responsibility or liability for the accuracy or
completeness of, or the presence of any virus or disabling code in, this
e-mail. If verification is sought please request a hard copy. Any reference
to the terms of executed transactions should be treated as preliminary only
and subject to formal written confirmation by Nomura. Nomura reserves the
right to monitor e-mail communications through its networks (in accordance
with applicable laws). No confidentiality or privilege is waived or lost by
Nomura by any mistransmission of this e-mail. Any reference to "Nomura" is
a reference to any entity in the Nomura Holdings, Inc. group. Please read
our Electronic Communications Legal Notice which forms part of this e-mail:
http://www.Nomura.com/email_disclaimer.htm