Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92945

Re: How to check in script if Python or Jython is used

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!217.188.199.168.MISMATCH!takemy.news.telefonica.de!telefonica.de!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <lac@openend.se>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'paths': 0.05; 'subject:How': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'subject:script': 0.09; 'cc:addr:python-list': 0.10; 'python': 0.11; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'message-id:@fido.openend.se': 0.16; 'received:89.233': 0.16; 'received:89.233.217': 0.16; 'received:89.233.217.133': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'laura': 0.18; 'cc:addr:python.org': 0.21; 'cc:2**1': 0.22; '2015': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'installed': 0.26; '+0200,': 0.27; 'this.': 0.28; 'received:se': 0.29; 'cc:no real name:2**1': 0.29; 'url:mailman': 0.31; 'run': 0.32; 'skip:p 30': 0.32; 'probably': 0.32; 'url:python': 0.33; 'url:listinfo': 0.35; 'execution': 0.35; 'skip:> 10': 0.35; 'url:org': 0.36; 'there': 0.36; 'subject:: ': 0.37; 'charset:us- ascii': 0.37; 'your': 0.60; 'determine': 0.61; 'header:Message- Id:1': 0.62; 'different': 0.64; 'between': 0.65; 'differences': 0.66; 'received:89': 0.80; '>if': 0.84; 'cecil': 0.84; 'subject:check': 0.84; 'taken.': 0.84; 'url:cecilwesterhof': 0.84; 'westerhof': 0.84
To Cecil Westerhof <Cecil@decebal.nl>
cc python-list@python.org, lac@openend.se
From Laura Creighton <lac@openend.se>
Subject Re: How to check in script if Python or Jython is used
In-Reply-To Message from Cecil Westerhof <Cecil@decebal.nl> of "Sun, 21 Jun 2015 10:12:06 +0200." <87r3p5pjjd.fsf@Equus.decebal.nl>
References <87r3p5pjjd.fsf@Equus.decebal.nl>
MIME-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-ID <30720.1434878576.1@fido>
Date Sun, 21 Jun 2015 11:22:56 +0200
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [89.233.217.130]); Sun, 21 Jun 2015 11:22:57 +0200 (CEST)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.673.1434878583.13271.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1434878583 news.xs4all.nl 2915 [2001:888:2000:d::a6]:43511
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:92945

Show key headers only | View raw


In a message of Sun, 21 Jun 2015 10:12:06 +0200, Cecil Westerhof writes:
>I installed Jython and will start playing with it. There probably will
>be differences between Python and Jython. Is there a way to determine
>if a script is run by Python or Jython? Then different execution paths
>could be taken. With sys.version(_info) you do not get this
>information.
>
>-- 
>Cecil Westerhof
>Senior Software Engineer
>LinkedIn: http://www.linkedin.com/in/cecilwesterhof
>-- 
>https://mail.python.org/mailman/listinfo/python-list

import platform
platform.python_implementation()

If your jython is old (pre 2.6) you will not have this.

Then try
platform.system()
which will give you 'Java'

Laura

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to check in script if Python or Jython is used Cecil Westerhof <Cecil@decebal.nl> - 2015-06-21 10:12 +0200
  Re: How to check in script if Python or Jython is used Laura Creighton <lac@openend.se> - 2015-06-21 11:22 +0200
    Re: How to check in script if Python or Jython is used Cecil Westerhof <Cecil@decebal.nl> - 2015-06-21 12:24 +0200
  Re: How to check in script if Python or Jython is used Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-21 18:12 +0200
  Re: How to check in script if Python or Jython is used Dan Stromberg <drsalists@gmail.com> - 2015-06-22 12:39 -0700

csiph-web