Python Forum
a python script i would like to have
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a python script i would like to have
#1
i would like to have a python script that, given the path to another script, will indicate if there is a reason that other script would need to be run under python 3 instead of python 2.  it should have a quiet option that also causes it to exit with an exit status value of 2 for scripts that need to run in python 2.  if there is a slash-bang and it runs python 2 or 3 explicitly then it should presume that is the version it needs.  if the slash-bang does not specify an explicit (e.g "python" with no version given in the name) version then it should look further on for clues.  things like usage of "long" or "xrange" (in real code, not in comments, string literals. or as part of other identifiers) indicate a need for python 2.

sounds like a big project to me.  i have built a little system to run python scripts with an explicit interpreter but i want it to know if version 2 is needed or use version 3 by default.  i want to add a means like this to figure it out.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
a python script i would like to have - by Skaperen - Oct-09-2016, 09:00 AM
RE: a python script i would like to have - by wavic - Oct-09-2016, 10:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,675 Jun-29-2023, 11:57 AM
Last Post: gologica
  How to kill a bash script running as root from a python script? jc_lafleur 4 6,141 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur
  crontab on RHEL7 not calling python script wrapped in shell script benthomson 1 2,408 May-28-2020, 05:27 PM
Last Post: micseydel
  Package python script which has different libraries as a single executable or script tej7gandhi 1 2,710 May-11-2019, 08:12 PM
Last Post: keames
  Check Python version from inside script? Run Pythons script in v2 compatibility mode? pstein 2 9,936 Jul-07-2017, 08:59 AM
Last Post: snippsat
  Cant pass corect variables to python script in bash script neradp 3 6,317 Nov-05-2016, 01:26 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020