473,409 Members | 2,022 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

100 % portable ?

i have some question about portability of python

for my part i work under the 3 systemes (windows , linux , mac os x
sometimes mac os classic too )

i want to know how i can be sure at 100 % that my programme is portable
(i dont want code each times i use other system )

i suppose for GUI is same

wich thing need i pay attention (language , system , library .. )
do you have some graphic library to propose (i see GTK , Tkinter and
WXwindow )

thankx in advance for you reply

East wind
Jul 18 '05 #1
16 1698
How can you be sure? I recommend you do it by writing a test-suite for
your software and running it on all the platforms you wish to target.

On the other hand, Python has had "pretty good" portability for me in
the past, at least where Windows, Linux, and Unix are concerned.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBKJ7rJd01MZaTXX0RAgo9AJ9oRbnBELKKQSlgdChWPx 3HiGUiOwCbBSpW
FfLI3BXczpX1nB+WVoml6/4=
=wMfB
-----END PGP SIGNATURE-----

Jul 18 '05 #2
Vent d'Est - East Wind wrote:
i want to know how i can be sure at 100 % that my programme is portable
(i dont want code each times i use other system )
You will have to run your program on all platforms. The Python
library documentation pages tell you which platform the modules
are on. The vast majority are on all.

Note that for some things you would want different code. For
example the default location to save files may be My Documents
on Windows and $HOME on Linux and Mac. Similarly you would
want to save configuration settings in the registry on Windows
and dot files on Linux and Mac.
i suppose for GUI is same


My preferred toolkit is the wxPython wrapper around wxWidgets.
Wherever possible it uses native widgets. It also has functionality
often lacked by other toolkits such as printing, keyboard,
configuration (backend to registry, files etc).

Just to give you some idea, in my 30,000 line program there are
5 tests to see what platform it is running on, specifically to
ensure appropriate defaults etc for the platform.

For the gui, there are two programs you can try that use wxPython.

http://dotamatic.sf.net
http://bitpim.org

Both are open source so you can see for yourself. Both use the
clipboard, do printing, have online help, are distributed so
that the user doesn't need Python on their machine already etc.

Roger
Jul 18 '05 #3
At some point, "Roger Binns" <ro****@rogerbinns.com> wrote:
Note that for some things you would want different code. For
example the default location to save files may be My Documents
on Windows and $HOME on Linux and Mac. Similarly you would
want to save configuration settings in the registry on Windows
and dot files on Linux and Mac.


For Mac the preferred place files is ~/Documents, and for config files
is in ~/Library/<application name>/.

--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca
Jul 18 '05 #4
On 2004-08-22, David M. Cooke <co**********@physics.mcmaster.ca> wrote:
For Mac the preferred place files is ~/Documents, and for config files
is in ~/Library/<application name>/.


Where to per-user config files go?

--
Grant Edwards grante Yow! NANCY!! Why is
at everything RED?!
visi.com
Jul 18 '05 #5
At some point, Grant Edwards <gr****@visi.com> wrote:
On 2004-08-22, David M. Cooke <co**********@physics.mcmaster.ca> wrote:
For Mac the preferred place files is ~/Documents, and for config files
is in ~/Library/<application name>/.


Where to per-user config files go?


~ == $HOME, so that's per-user.

--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca
Jul 18 '05 #6
You can use os.environ["HOME"], this will return the user's home dir.

Roger Binns wrote:
Note that for some things you would want different code. For
example the default location to save files may be My Documents
on Windows and $HOME on Linux and Mac. Similarly you would
want to save configuration settings in the registry on Windows
and dot files on Linux and Mac.


Jul 18 '05 #7
Roger Binns <ro****@rogerbinns.com> wrote:
My preferred toolkit is the wxPython wrapper around wxWidgets.
Wherever possible it uses native widgets. [ ... ]

Just to give you some idea, in my 30,000 line program there are
5 tests to see what platform it is running on, specifically to
ensure appropriate defaults etc for the platform.


Sounds about right to me -- I've got about 20,000 lines of
application with six platform tests, five of which are to
work around platform-specific infelicities in wx.

--
\S -- si***@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomež se bera eadward ofdun hlęddre heafdes bęce bump bump bump
Jul 18 '05 #8
Sion Arrowsmith <si***@chiark.greenend.org.uk> writes:
Roger Binns <ro****@rogerbinns.com> wrote:
My preferred toolkit is the wxPython wrapper around wxWidgets.
Wherever possible it uses native widgets. [ ... ]

Just to give you some idea, in my 30,000 line program there are
5 tests to see what platform it is running on, specifically to
ensure appropriate defaults etc for the platform.


Sounds about right to me -- I've got about 20,000 lines of
application with six platform tests, five of which are to
work around platform-specific infelicities in wx.


This sounds very interesting.

Do any of you have those tests and workarounds publicly available?

--
Godoy. <go***@ieee.org>
Jul 18 '05 #9
http://dotamatic.sf.net
http://bitpim.org

Both are open source so you can see for yourself. Both use the
clipboard, do printing, have online help, are distributed so
that the user doesn't need Python on their machine already etc.

Roger


i see your website , but i see for mac os x you using cocoa interfacing
i don't understand isnt WXpython from WXwindow and have in all system
same apparence ?

same for linux i see a like kde 2 interfacing using

seems each you use each interface of each system
(and not just one for every system)

is that only using wxpython or add some other graphic toolkit port and
using cocoa , kde interface ?

thankx for reply
Jul 18 '05 #10
In article <2o************@uni-berlin.de>, Bernd Kaiser wrote:
You can use os.environ["HOME"], this will return the user's home dir.


Doesn't work in win9x AFAIK. I do notice that some people are starting to
require XP for their apps.

Dave Cook
Jul 18 '05 #11
[Bernd Kaiser]
You can use os.environ["HOME"], this will return the user's home dir.

[Dave Cook] Doesn't work in win9x AFAIK. I do notice that some people are
starting to require XP for their apps.


HOME isn't defined on my vanilla XP box. HOMEDRIVE and HOMEPATH are, though.
Jul 18 '05 #12
Tim Peters wrote:
[Bernd Kaiser]

You can use os.environ["HOME"], this will return the user's home dir.

See this old thread:
http://groups.google.ca/groups?threa...t%40python.org

The OpenGLContext code should work for Win98, 2K, and XP, maybe for
Win95 and NT too, but I don't have them for testing.

Enjoy,
Mike

________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com

Jul 18 '05 #13
At some point, Vent d'Est - East Wind <po*********@pandora.be> wrote:
http://dotamatic.sf.net
http://bitpim.org
Both are open source so you can see for yourself. Both use the
clipboard, do printing, have online help, are distributed so
that the user doesn't need Python on their machine already etc.
Roger


i see your website , but i see for mac os x you using cocoa interfacing
i don't understand isnt WXpython from WXwindow and have in all system
same apparence ?

same for linux i see a like kde 2 interfacing using

seems each you use each interface of each system
(and not just one for every system)

is that only using wxpython or add some other graphic toolkit port and
using cocoa , kde interface ?


I think you've missed the point of wxWidgets/wxPython: it uses native
widgets on each platform. On OS X, it uses Aqua widgets; on Linux, QT
or GTK, on Windows, native Windows widgets.

So, you're not going to get the same appearence on different
platforms (which is a good thing; I don't want to use something that
looks like Windows on a Mac).

--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca
Jul 18 '05 #14
In article <m3************@g2ctech.com>, Jorge Godoy <go***@ieee.org> wrote:
Sion Arrowsmith <si***@chiark.greenend.org.uk> writes:
I've got about 20,000 lines of
application with six platform tests, five of which are to
work around platform-specific infelicities in wx.

This sounds very interesting.

Do any of you have those tests and workarounds publicly available?


The tests are just a matter of checking sys.platform at the
appropriate point -- since the target platforms ATM are only
Windows and Linux a simple == "win32" or != "win32" depending
on which requires special treatment (usually Linux/GTK) does
the job.

I really should stick at least some of this stuff on the wiki
(http://wiki.wxpython.org/index.cgi/w...nconsistencies)
-- for that matter, I should refine and bug-report the ones I
haven't already.

--
\S -- si***@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomež se bera eadward ofdun hlęddre heafdes bęce bump bump bump
Jul 18 '05 #15
Hello Tim,
[Bernd Kaiser]
You can use os.environ["HOME"], this will return the user's home dir.


[Dave Cook]
Doesn't work in win9x AFAIK. I do notice that some people are
starting to require XP for their apps.


HOME isn't defined on my vanilla XP box. HOMEDRIVE and HOMEPATH are, though.

import user
print user.home

Bye.
--
------------------------------------------------------------------------
Miki Tebeka <mi*********@zoran.com>
http://tebeka.spymac.net
The only difference between children and adults is the price of the toys
Jul 18 '05 #16


I think you've missed the point of wxWidgets/wxPython: it uses native
widgets on each platform. On OS X, it uses Aqua widgets; on Linux, QT
or GTK, on Windows, native Windows widgets.

So, you're not going to get the same appearence on different
platforms (which is a good thing; I don't want to use something that
looks like Windows on a Mac).


yeah i like it too Acqua style , but what i didn't understand before
it s how it can be do that (my point of view was like a java vm , so
that s why i think it s same apparence in other system too)
now i visited wxwidget , explanation simple and interresting :)
just what i search , graphical toolkit native on different plateforme
supporting same code :)

thankxx a lot
Jul 18 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: James Harris | last post by:
Hi, Can someone recommend a book that will teach me how to approach C programming so that code is modularised, will compile for different environments (such as variations of Unix and Windows),...
22
by: SeeBelow | last post by:
Is there any way, in C, of interacting with a running program, but still using code that is portable, at least between linux and Windows? By "interacting" it could be something as simple as...
10
by: Jason Curl | last post by:
Dear C group, I'm very interested in writing portable C, but I only have GNU, Sparc and Cygwin to compile on. What I find is the biggest problem to writing portable C is what headers to...
8
by: suresh_C# | last post by:
Dear All, What is difference between Portable Executable (PE) file and a Assembly? Thanks, Mahesh
2
by: Tull Clancey | last post by:
Hi all. I'm nearing completion of a host app that needs to send data to, and receive data back from a portable, an HP device. The application running on the portable will be a .net application....
131
by: pemo | last post by:
Is C really portable? And, apologies, but this is possibly a little OT? In c.l.c we often see 'not portable' comments, but I wonder just how portable C apps really are. I don't write...
162
by: Richard Heathfield | last post by:
I found something interesting on the Web today, purely by chance. It would be funny if it weren't so sad. Or sad if it weren't so funny. I'm not sure which. ...
409
by: jacob navia | last post by:
I am trying to compile as much code in 64 bit mode as possible to test the 64 bit version of lcc-win. The problem appears now that size_t is now 64 bits. Fine. It has to be since there are...
10
by: bramnizzle | last post by:
I don't know if this is the right thread or not, but... In my endless pursuit to hold on to my dinosaur laptop (Dell 1100 Inspiron - circa 2004)...I want to keep as much space free for my...
23
by: asit | last post by:
what is the difference between portable C, posix C and windows C ???
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.