Message10183

Author stefan.richthofer
Recipients stefan.richthofer
Date 2015-08-30.13:26:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1440941217.55.0.924735338666.issue2386@psf.upfronthosting.co.za>
In-reply-to
Content
I just worked out and tested variant 2):

if not sys.executable is None:
    project_base = os.path.dirname(os.path.realpath(sys.executable))
else:
    from java.lang import System
    from java.io import File as jFile
    cpstr = System.getProperty('java.class.path')
    cps = cpstr.split(jFile.pathSeparator)
    for fl in cps:
        file = jFile(fl)
        if (file.isFile()):
            fn = file.getName()
            if (fn.startswith("jython") and fn.endswith(".jar")):
                project_base = file.getParentFile().getAbsolutePath()+jFile.separator+"bin"


It appears to be working fine, at least if jython.jar was not renamed to something cumbersome. Still, this should avoid the problem in 99.9% of the cases. If there are no objections, I would merge this into master.

Cheers
History
Date User Action Args
2015-08-30 13:26:57stefan.richthofersetmessageid: <1440941217.55.0.924735338666.issue2386@psf.upfronthosting.co.za>
2015-08-30 13:26:57stefan.richthofersetrecipients: + stefan.richthofer
2015-08-30 13:26:57stefan.richthoferlinkissue2386 messages
2015-08-30 13:26:57stefan.richthofercreate