100 % portable ?

Discussion in 'Python' started by Vent d'Est - East Wind, Aug 22, 2004.

  1. 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
     
    Vent d'Est - East Wind, Aug 22, 2004
    #1
    1. Advertising

  2. Vent d'Est - East Wind

    Jeff Epler Guest

    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)

    iD8DBQFBKJ7rJd01MZaTXX0RAgo9AJ9oRbnBELKKQSlgdChWPx3HiGUiOwCbBSpW
    FfLI3BXczpX1nB+WVoml6/4=
    =wMfB
    -----END PGP SIGNATURE-----
     
    Jeff Epler, Aug 22, 2004
    #2
    1. Advertising

  3. Vent d'Est - East Wind

    Roger Binns Guest

    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
     
    Roger Binns, Aug 22, 2004
    #3
  4. At some point, "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.


    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
     
    David M. Cooke, Aug 22, 2004
    #4
  5. On 2004-08-22, David M. Cooke <> 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
     
    Grant Edwards, Aug 22, 2004
    #5
  6. At some point, Grant Edwards <> wrote:

    > On 2004-08-22, David M. Cooke <> 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
     
    David M. Cooke, Aug 22, 2004
    #6
  7. Vent d'Est - East Wind

    Bernd Kaiser Guest

    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.
     
    Bernd Kaiser, Aug 23, 2004
    #7
  8. Roger Binns <> 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 -- -- 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
     
    Sion Arrowsmith, Aug 23, 2004
    #8
  9. Vent d'Est - East Wind

    Jorge Godoy Guest

    Sion Arrowsmith <> writes:

    > Roger Binns <> 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. <>
     
    Jorge Godoy, Aug 23, 2004
    #9

  10. > 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
     
    Vent d'Est - East Wind, Aug 23, 2004
    #10
  11. Vent d'Est - East Wind

    Dave Cook Guest

    In article <>, 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
     
    Dave Cook, Aug 23, 2004
    #11
  12. Vent d'Est - East Wind

    Tim Peters Guest

    [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.
     
    Tim Peters, Aug 23, 2004
    #12
  13. 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?threadm=

    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
     
    Mike C. Fletcher, Aug 23, 2004
    #13
  14. At some point, Vent d'Est - East Wind <> 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
     
    David M. Cooke, Aug 23, 2004
    #14
  15. In article <>, Jorge Godoy <> wrote:
    >Sion Arrowsmith <> 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/wxPython_20Platform_20Inconsistencies)
    -- for that matter, I should refine and bug-report the ones I
    haven't already.

    --
    \S -- -- 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
     
    Sion Arrowsmith, Aug 24, 2004
    #15
  16. Vent d'Est - East Wind

    Miki Tebeka Guest

    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 <>
    http://tebeka.spymac.net
    The only difference between children and adults is the price of the toys
     
    Miki Tebeka, Aug 25, 2004
    #16

  17. >
    >
    > 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
     
    Vent d'Est - East Wind, Aug 25, 2004
    #17
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Klemt
    Replies:
    2
    Views:
    423
    Marina
    Jul 28, 2003
  2. Not4u
    Replies:
    9
    Views:
    1,056
    Not4u
    Feb 27, 2004
  3. Replies:
    8
    Views:
    6,710
    Neredbojias
    Dec 9, 2005
  4. fred
    Replies:
    3
    Views:
    291
    Zifud
    Mar 17, 2005
  5. Replies:
    5
    Views:
    903
Loading...

Share This Page