osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: Jython and PYTHONPATH environment variable -
msg#00007

List: lang.jython.devel

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

Hello,

Is there some reason Jython is not processing PYTHONPATH environment
variable and putting entries there into sys.path similarly as CPython?
I know you can use command line option -Dpython.path but consistency
would be nice at least for people coming from CPython.

Processing PYTHONPATH would be pretty trivial -- there's one example
below -- and could probably be done somewhere during Jython
initialization. I was thinking about submitting this into
jython.org/bugs but decided to ask here first.

Cheers,
.peke

Jython 2.2rc1 on java1.6.0
Type "copyright", "credits" or "license" for more information.
>>> import sys, os
>>> sys.path
['', '/home/peke/workspace/jython/dist/Lib', '__classpath__']
>>> for item in os.environ.get('PYTHONPATH', '').split(os.pathsep):
... if os.path.exists(item):
... sys.path.insert(1, item)
...
>>> sys.path
['', '/tmp', '/home/peke/workspace/jython/dist/Lib', '__classpath__']
>>>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/


Thread at a glance:

Previous Message by Date:

Re: second release candidate

Alan: Good job handling all the socket / select bug reports !Oti.On 7/1/07, Alan Kennedy <jython-dev@xxxxxxxxx > wrote:[Charlie]> Alan has fixed several bugs in the new socket and select over the past > week, and Oti has fixed some bugs in the installer and in the parser,> so I think I second release candidate is in order.   I've tagged all> of the bugs I think need to be fixed for it to go out with "targeted > for 2.2rc2" in the bugtracker.  I think most of them are already fixed> or have known solutions, so if nothing new crops up I'd like to make> the second candidate next weekend.Thanks Charlie. I've fixed all but one of the bugs, and checked the fixes in.I'm leaving one last bug openSimultaneous read & write on socket FileWrapper causes hang http://sourceforge.net/tracker/index.php?func=detail&aid=1744567&group_id=12867&atid=112867because although we know that's caused by underlying java behaviour, andhave documented the fact, along with several workarounds, it's still not fixed.I'm leaving it open because I think it should be possible to implementsocket.makefile() in such a way that the underlying java bug is avoided.But it could take a few weeks before I get around to researching and implementing that.OK to leave the bug open?Alternatives might be to mark it "Remind", or some such? Or lower thepriority?(Also, I've changed the description from "Socket hangs in 2.2RC1", whichwas inaccurate and a little alarmist).Otherwise, I'm happy for 2.2rc2 to go ahead, whenever you're ready.Onwards and upwards!Regards,Alan.------------------------------------------------------------------------- This SF.net email is sponsored by DB2 ExpressDownload DB2 Express C - the FREE version of DB2 express and takecontrol of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/_______________________________________________Jython-dev mailing listJython-dev@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/jython-dev ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/_______________________________________________ Jython-dev mailing list Jython-dev@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/jython-dev

Next Message by Date:

Re: Jython and PYTHONPATH environment variable

Hi Peke,one possible reason, IMHO, could be that it is not trivial to access environment variables from java safely on all platforms.I really do not want to use Runtime.exec() during PySystemState.initialize () to get those env vars - because of the time that takes - because of the danger dealing with platform related issuesOne possibility would be to create start scripts which add PYTHONPATH, if present, to the - Dpython.path option.But this would not help in embedding use cases.So I have no satisfying, general solution.What do others think ?best wishes,Oti.On 7/4/07, Pekka Laukkanen <peke@xxxxxx> wrote: Hello,Is there some reason Jython is not processing PYTHONPATH environmentvariable and putting entries there into sys.path similarly as CPython?I know you can use command line option -Dpython.path but consistency would be nice at least for people coming from CPython.Processing PYTHONPATH would be pretty trivial -- there's one examplebelow -- and could probably be done somewhere during Jythoninitialization. I was thinking about submitting this into jython.org/bugs but decided to ask here first.Cheers,    .pekeJython 2.2rc1 on java1.6.0Type "copyright", "credits" or "license" for more information. >>> import sys, os>>> sys.path['', '/home/peke/workspace/jython/dist/Lib', '__classpath__']>>> for item in os.environ.get('PYTHONPATH', '').split( os.pathsep):...     if os.path.exists(item):...         sys.path.insert(1, item)...>>> sys.path['', '/tmp', '/home/peke/workspace/jython/dist/Lib', '__classpath__'] >>>-------------------------------------------------------------------------This SF.net email is sponsored by DB2 ExpressDownload DB2 Express C - the FREE version of DB2 express and takecontrol of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/_______________________________________________Jython-dev mailing list Jython-dev@xxxxxxxxxxxxxxxxxxxxxhttps://lists.sourceforge.net/lists/listinfo/jython-dev ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/_______________________________________________ Jython-dev mailing list Jython-dev@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/jython-dev

Previous Message by Thread:

second release candidate

Alan has fixed several bugs in the new socket and select over the past week, and Oti has fixed some bugs in the installer and in the parser, so I think I second release candidate is in order. I've tagged all of the bugs I think need to be fixed for it to go out with "targeted for 2.2rc2" in the bugtracker. I think most of them are already fixed or have known solutions, so if nothing new crops up I'd like to make the second candidate next weekend. Charlie ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/

Next Message by Thread:

Re: Jython and PYTHONPATH environment variable

Hi Peke,one possible reason, IMHO, could be that it is not trivial to access environment variables from java safely on all platforms.I really do not want to use Runtime.exec() during PySystemState.initialize () to get those env vars - because of the time that takes - because of the danger dealing with platform related issuesOne possibility would be to create start scripts which add PYTHONPATH, if present, to the - Dpython.path option.But this would not help in embedding use cases.So I have no satisfying, general solution.What do others think ?best wishes,Oti.On 7/4/07, Pekka Laukkanen <peke@xxxxxx> wrote: Hello,Is there some reason Jython is not processing PYTHONPATH environmentvariable and putting entries there into sys.path similarly as CPython?I know you can use command line option -Dpython.path but consistency would be nice at least for people coming from CPython.Processing PYTHONPATH would be pretty trivial -- there's one examplebelow -- and could probably be done somewhere during Jythoninitialization. I was thinking about submitting this into jython.org/bugs but decided to ask here first.Cheers,    .pekeJython 2.2rc1 on java1.6.0Type "copyright", "credits" or "license" for more information. >>> import sys, os>>> sys.path['', '/home/peke/workspace/jython/dist/Lib', '__classpath__']>>> for item in os.environ.get('PYTHONPATH', '').split( os.pathsep):...     if os.path.exists(item):...         sys.path.insert(1, item)...>>> sys.path['', '/tmp', '/home/peke/workspace/jython/dist/Lib', '__classpath__'] >>>-------------------------------------------------------------------------This SF.net email is sponsored by DB2 ExpressDownload DB2 Express C - the FREE version of DB2 express and takecontrol of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/_______________________________________________Jython-dev mailing list Jython-dev@xxxxxxxxxxxxxxxxxxxxxhttps://lists.sourceforge.net/lists/listinfo/jython-dev ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/_______________________________________________ Jython-dev mailing list Jython-dev@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/jython-dev
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!