LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-12-2008, 02:55 AM   #1
browny_amiga
Member
 
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Buster Stable, Windoze 7
Posts: 684

Rep: Reputation: 56
Talking Python multi platform conform code: how to find out on which OS you are?


Hi

I am writing a little program in python and would like to make sure it runs on all OSes (for the start at least Windows and Linux).

Are there any guides for this, what to pay attention to?
I am using Tkinter for the GUI, which looks butt ugly on Linux (*grin*), but is a point to start at and it is portable and simple.

Path names are obviously an issue. Great that you can at least use / on all OSes, even on Windows. Now is there a surefire way to find out on which OS type you are running to make the program decide which path names to use?

Cheers

Markus

P.S. As I understand, Tkinter on Linux uses Tk or Tc, some old archaic GUI that is independent of KDE or Gnome. Is there any way to map these GUIs to QT or GTK so it does not look so hideous?
 
Old 11-12-2008, 08:48 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by browny_amiga View Post
Now is there a surefire way to find out on which OS type you are running to make the program decide which path names to use?
Why would you even care - what about the macs, or some new OS ???. Use something agnostic like os.path
 
Old 11-13-2008, 04:14 AM   #3
browny_amiga
Member
 
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Buster Stable, Windoze 7
Posts: 684

Original Poster
Rep: Reputation: 56
Quote:
Originally Posted by syg00 View Post
Why would you even care - what about the macs, or some new OS ???. Use something agnostic like os.path
Thanx for the pointer.

Well, the future is multi platform, a program should run on any OS, not discriminating anyone. (because the OS will lose more and more importance. I hate having to setup a Windows, pay license for it just to run some application that could also easily run on a Ubuntu. Why not develop from the very start to accommodate that?
I am for example a passionate gamer and am so far dependent on Windows for quality games. I wished all these games would be available for Linux too, so I could send my XP machine to hell, but unfortunately these companies develop Windows centric and not multi platform and with such a limited architecture, porting becomes very hard.

So far I am developing this program for myself, it has no wider audience and pragmatically, I must limit myself to these two platforms.

When I find that other users will be interested, more platforms can of course be integrated easily. It surely will license it under the GPL.

Markus
 
Old 11-13-2008, 11:23 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
In which case have a look at the os module - os.name
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Interesting new Linux multi-platform admin software Joncamp Linux - Software 1 12-14-2007 02:07 PM
Multi-platform network monitor tools? goldfish Linux - Software 1 03-08-2006 08:10 PM
looking for voice chat (multi-platform) deNiro Linux - Software 3 08-31-2004 02:58 PM
Uninstalling RedHat 9.1 on multi boot platform mbeutel Red Hat 1 08-07-2004 05:13 AM
Multi-Platform Development/Programming al042077 Linux - Software 1 04-05-2004 05:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration