Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
version/compile info
#11
Python 2:
Output:
>>> import sys >>> sys.platform 'linux2' >>>
Python 3:
Output:
>>> import sys >>> sys.platform 'linux' >>>
It's not a bug, it's a 'feature'. The '3' was removed in Python 3.3

See https://bugs.python.org/issue12326 for a long winded 'official' discussion.

For a summary see: https://stackoverflow.com/questions/1041...not-linux3

In the summary link it is suggested to use one of:
sys.platform.startswith('linux')

sys.platform == 'linux' # if you don't need to support older Python versions

It is also mentioned that 'win32' is used on all Windows systems, as apparently the term 'Win64' offends Microsoft.

Lewis
To paraphrase: 'Throw out your dead' code. https://www.youtube.com/watch?v=grbSQ6O6kbs Forward to 1:00
Reply
#12
so it really was (not is, anymore) the Linux version. you know they could have done:
  if 'linux' in sys.platform: # Is it any version of Linux?
so does the "win32" platform have any 64-bit capability? maybe i'll just keep on offending Microsoft by saying "they don't even have a 64-bit API, yet, and are still doing 'win32'". or people need to do:
  if 'win' in sys.platform:
        raise TypeError('Bad platform type == you lose')
Tradition is peer pressure from dead people

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


Possibly Related Threads…
Thread Author Replies Views Last Post
  What is all the info in the info window in Idle? Pedroski55 3 647 Jul-08-2023, 11:26 AM
Last Post: DeaD_EyE
  Can I upload a new version without previously deleting ancient version sylas 6 4,183 Nov-08-2017, 03:26 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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