Python Portability--Not very portable?

Discussion in 'Python' started by W. eWatson, Aug 6, 2010.

  1. W. eWatson

    W. eWatson Guest

    In my on-again-off-again experience with Python for 18 months,
    portability seems an issue.

    As an example, my inexperienced Python partner 30 miles away has gotten
    out of step somehow. I think by installing a different version of numpy
    than I use. I gave him a program we both use months ago, and he had no
    trouble. (We both use IDLE on 2.5). I made a one character change to it
    and sent him the new py file. He can't execute it. I doubt he has
    changed anything in the intervening period.

    A further example. Months ago I decided to see if I could compile a
    program to avoid such problems as above. I planned to satisfy that need,
    and see if I could distribute some simple programs to non-Python
    friends. I pretty well understand the idea,and got it working with a
    small program. It seemed like a lot of manual labor to do it.
    W. eWatson, Aug 6, 2010
    #1
    1. Advertising

  2. On Thu, Aug 5, 2010 at 6:50 PM, W. eWatson <> wrote:
    > In my on-again-off-again experience with Python for 18 months, portability
    > seems an issue.
    >
    > As an example, my inexperienced Python partner 30 miles away has gotten out
    > of step somehow. I think by installing a different version of numpy than I
    > use. I gave him a program we both use months ago, and he had no trouble. (We
    > both use IDLE on 2.5). I made a one character change to it and sent him the
    > new py file. He can't execute it. I doubt he has changed anything in the
    > intervening period.


    Portability doesn't mean you can use different versions of your
    dependencies and be A-OK. It should be fairly obvious that if the
    behavior of your dependencies changes, your code needs to change to
    ensure that it demonstrates the same behavior. Portability also
    doesn't mean that any given one-character change is valid, so that may
    be your issue as well.

    > A further example. Months ago I decided to see if I could compile a program
    > to avoid such problems as above. I planned to satisfy that need, and see if
    > I could distribute some simple programs to non-Python friends. I pretty well
    > understand the idea,and got it working with a small program. It seemed like
    > a lot of manual labor to do it.


    What, why were you compiling a program? And why not just use distutils?

    Geremy Condra
    geremy condra, Aug 6, 2010
    #2
    1. Advertising

  3. W. eWatson

    W. eWatson Guest

    On 8/5/2010 7:45 PM, geremy condra wrote:
    > On Thu, Aug 5, 2010 at 6:50 PM, W. eWatson<> wrote:
    >> In my on-again-off-again experience with Python for 18 months, portability
    >> seems an issue.
    >>
    >> As an example, my inexperienced Python partner 30 miles away has gotten out
    >> of step somehow. I think by installing a different version of numpy than I
    >> use. I gave him a program we both use months ago, and he had no trouble. (We
    >> both use IDLE on 2.5). I made a one character change to it and sent him the
    >> new py file. He can't execute it. I doubt he has changed anything in the
    >> intervening period.

    >
    > Portability doesn't mean you can use different versions of your
    > dependencies and be A-OK. It should be fairly obvious that if the
    > behavior of your dependencies changes, your code needs to change to
    > ensure that it demonstrates the same behavior. Portability also
    > doesn't mean that any given one-character change is valid, so that may
    > be your issue as well.
    >
    >> A further example. Months ago I decided to see if I could compile a program
    >> to avoid such problems as above. I planned to satisfy that need, and see if
    >> I could distribute some simple programs to non-Python friends. I pretty well
    >> understand the idea,and got it working with a small program. It seemed like
    >> a lot of manual labor to do it.

    >
    > What, why were you compiling a program? And why not just use distutils?
    >
    > Geremy Condra


    I checked the one char change on my system thoroughly. I looked around
    on some forums and NGs 4 months ago, and found no one even had a simple
    "compiled program" available to even demonstrate some simple example.

    I would think there are some small time and big time Python players who
    sell executable versions of their programs for profit?

    disutils. Sounds familiar. I'm pretty sure I was using Py2Exe, and
    disutils might have been part of it.

    So how does one keep a non-Python user in lock step with my setup, so
    these problems don't arise? I don't even want to think about having him
    uninstall and re-install. :) Although maybe he could do it without
    making matters worse.
    W. eWatson, Aug 6, 2010
    #3
  4. On Thu, Aug 5, 2010 at 8:28 PM, W. eWatson <> wrote:
    > On 8/5/2010 7:45 PM, geremy condra wrote:
    >>
    >> On Thu, Aug 5, 2010 at 6:50 PM, W. eWatson<>  wrote:
    >>>
    >>> In my on-again-off-again experience with Python for 18 months,
    >>> portability
    >>> seems an issue.
    >>>
    >>> As an example, my inexperienced Python partner 30 miles away has gotten
    >>> out
    >>> of step somehow. I think by installing a different version of numpy than
    >>> I
    >>> use. I gave him a program we both use months ago, and he had no trouble..
    >>> (We
    >>> both use IDLE on 2.5). I made a one character change to it and sent him
    >>> the
    >>> new py file. He can't execute it. I doubt he has changed anything in the
    >>> intervening period.

    >>
    >> Portability doesn't mean you can use different versions of your
    >> dependencies and be A-OK. It should be fairly obvious that if the
    >> behavior of your dependencies changes, your code needs to change to
    >> ensure that it demonstrates the same behavior. Portability also
    >> doesn't mean that any given one-character change is valid, so that may
    >> be your issue as well.
    >>
    >>> A further example. Months ago I decided to see if I could compile a
    >>> program
    >>> to avoid such problems as above. I planned to satisfy that need, and see
    >>> if
    >>> I could distribute some simple programs to non-Python friends. I pretty
    >>> well
    >>> understand the idea,and got it working with a small program. It seemed
    >>> like
    >>> a lot of manual labor to do it.

    >>
    >> What, why were you compiling a program? And why not just use distutils?
    >>
    >> Geremy Condra

    >
    > I checked the one char change on my system thoroughly. I looked around on
    > some forums and NGs 4 months ago, and found no one even had a simple
    > "compiled program" available to even demonstrate some simple example.


    That would be because Python is an interpreted language.

    > I would think there are some small time and big time Python players who sell
    > executable versions of their programs for profit?


    Yes. What's your point?

    > disutils. Sounds familiar. I'm pretty sure I was using Py2Exe, and disutils
    > might have been part of it.


    distutils.

    http://docs.python.org/library/distutils.html

    > So how does one keep a non-Python user in lock step with my setup, so these
    > problems don't arise? I don't even want to think about having him uninstall
    > and re-install. :) Although maybe he could do it without making matters
    > worse.


    That's going to hinge on what your dependencies are.

    Geremy Condra
    geremy condra, Aug 6, 2010
    #4
  5. Re: Python Portability

    In message <i3fpos$p7u$-september.org>, W. eWatson wrote:

    > I made a one character change to it and sent him the new py file. He can't
    > execute it.


    What exactly was the problem?
    Lawrence D'Oliveiro, Aug 6, 2010
    #5
  6. W. eWatson

    W. eWatson Guest


    >> I would think there are some small time and big time Python players who sell
    >> executable versions of their programs for profit?

    >
    > Yes. What's your point?

    That someone must know how to distribute them without having the source
    code ripped off.
    >
    >> disutils. Sounds familiar. I'm pretty sure I was using Py2Exe, and disutils
    >> might have been part of it.

    >
    > distutils.
    >
    > http://docs.python.org/library/distutils.html

    I don't see ;how distutils is going to solve this problem. Are you
    suggesting the program should be packaged? Why? I can just send it to
    him as py code. distutils looks like it's for library modules, e.g.,
    functions like math.
    >
    >> So how does one keep a non-Python user in lock step with my setup, so these
    >> problems don't arise? I don't even want to think about having him uninstall
    >> and re-install. :) Although maybe he could do it without making matters
    >> worse.

    >
    > That's going to hinge on what your dependencies are.
    >
    > Geremy Condra
    W. eWatson, Aug 6, 2010
    #6
  7. W. eWatson

    Peter Otten Guest

    W. eWatson wrote:

    >>> I would think there are some small time and big time Python players who
    >>> sell executable versions of their programs for profit?

    >>
    >> Yes. What's your point?

    > That someone must know how to distribute them without having the source
    > code ripped off.


    Yes, but he won't tell for fear of getting ripped off of his knowledge.
    Peter Otten, Aug 6, 2010
    #7
  8. W. eWatson

    W. eWatson Guest

    I can't respond to otten directly, since he uses gmane. Here's my response.

    W. eWatson wrote:

    >>> >>> I would think there are some small time and big time Python

    players who
    >>> >>> sell executable versions of their programs for profit?
    >> >>
    >> >> Yes. What's your point?

    > > That someone must know how to distribute them without having the source
    > > code ripped off.

    Ott wrote?
    Yes, but he won't tell for fear of getting ripped off of his knowledge.


    Who won't tell? Why would I send you the py code, for example, if I
    wanted to protect it because of its importance? I'd put it in exe form
    and send it and allow you to input data to produce the desired result of
    the program.
    W. eWatson, Aug 6, 2010
    #8
  9. W. eWatson

    Peter Otten Guest

    W. eWatson wrote:

    > I can't respond to otten directly, since he uses gmane. Here's my
    > response.
    >
    > W. eWatson wrote:
    >
    > >>> >>> I would think there are some small time and big time Python

    > players who
    > >>> >>> sell executable versions of their programs for profit?
    > >> >>
    > >> >> Yes. What's your point?
    > > > That someone must know how to distribute them without having the
    > > > source code ripped off.

    > Ott wrote?
    > Yes, but he won't tell for fear of getting ripped off of his knowledge.
    >
    >
    > Who won't tell?


    The the guy who knows how to distribute the source code without having it
    ripped off...

    Seriously, I try to make a joke once in a while, usually with devastating
    results. The idea you were meant to take away was that once you start
    thinking about a protection scheme there is always a next step until you
    reach the point where your software, say, is completely safe, but also
    completely unusable. Had Guido started the language in that mindset there
    would be no Python for you to worry about its ripp-off safety.

    > Why would I send you the py code, for example, if I
    > wanted to protect it because of its importance?


    Because if you think again you may find that it's not as important as you
    think?

    > I'd put it in exe form
    > and send it and allow you to input data to produce the desired result of
    > the program.


    There is no analog in python, and if you cannot concentrate on your honest
    customers the only option that offers reasonable "safety" would be to turn
    your application into web service.

    Peter
    Peter Otten, Aug 6, 2010
    #9
  10. On Fri, Aug 6, 2010 at 8:00 AM, W. eWatson <> wrote:
    >
    >>> I would think there are some small time and big time Python players who
    >>> sell
    >>> executable versions of their programs for profit?

    >>
    >> Yes. What's your point?

    >
    > That someone must know how to distribute them without having the source code
    > ripped off.


    I've never seen a code obfuscation scheme I thought did the job the
    whole way, including compiling C, and Python bytecode is significantly
    easier to turn back into something resembling the original source
    (YMMV, I suppose). Also, if you don't know about common tools like
    distutils, the odds are pretty good that it isn't your code itself
    that is valuable to you- you're probably more interested in protecting
    your idea about what the code should do. At least for now, that's
    outside of the scope of technical solutions- discuss it with a lawyer,
    not a programmer.

    >>
    >>> disutils. Sounds familiar. I'm pretty sure I was using Py2Exe, and
    >>> disutils
    >>> might have been part of it.

    >>
    >> distutils.
    >>
    >> http://docs.python.org/library/distutils.html

    >
    > I don't see ;how distutils is going to solve this problem. Are you
    > suggesting the program should be packaged? Why? I can just send it to him as
    > py code. distutils looks like it's for library modules, e.g., functions like
    > math.


    ....no. Distutils is handy because you could just bundle your
    dependencies and hand them an easy-to-install package, which would be
    a quick way to get everybody on the same page. Of course, depending on
    the licenses those dependencies are under you might want to do even
    more talking to a lawyer than I've previously suggested before you go
    about trying to sell that bundle- I'm sure you wouldn't want to 'rip
    off' great free projects like python and numpy.

    Geremy Condra
    geremy condra, Aug 6, 2010
    #10
  11. W. eWatson

    W. eWatson Guest

    On 8/6/2010 9:03 AM, Peter Otten wrote:
    ....
    >
    > Seriously, I try to make a joke once in a while, usually with devastating
    > results. The idea you were meant to take away was that once you start
    > thinking about a protection scheme there is always a next step until you
    > reach the point where your software, say, is completely safe, but also
    > completely unusable. Had Guido started the language in that mindset there
    > would be no Python for you to worry about its ripp-off safety.
    >
    >> Why would I send you the py code, for example, if I
    >> wanted to protect it because of its importance?

    >
    > Because if you think again you may find that it's not as important as you
    > think?
    >
    >> I'd put it in exe form
    >> and send it and allow you to input data to produce the desired result of
    >> the program.

    >
    > There is no analog in python, and if you cannot concentrate on your honest
    > customers the only option that offers reasonable "safety" would be to turn
    > your application into web service.
    >
    > Peter

    So you think Python is part of open software in terms of distributing a
    "product"? So I should stick to C, where one can distribute programs w/o
    revealing code details, and having a customer compile the code? It's
    been awhile since I've used Linux or Unix, but I think there's a lot of
    commercial code out there dependent upon it, and the users do not have
    to compile anything.
    W. eWatson, Aug 6, 2010
    #11
  12. W. eWatson

    W. eWatson Guest

    On 8/6/2010 10:31 AM, geremy condra wrote:
    > On Fri, Aug 6, 2010 at 8:00 AM, W. eWatson<> wrote:
    >>
    >>>> I would think there are some small time and big time Python players who
    >>>> sell
    >>>> executable versions of their programs for profit?
    >>>
    >>> Yes. What's your point?

    >>
    >> That someone must know how to distribute them without having the source code
    >> ripped off.

    >
    > I've never seen a code obfuscation scheme I thought did the job the
    > whole way, including compiling C, and Python bytecode is significantly
    > easier to turn back into something resembling the original source
    > (YMMV, I suppose). Also, if you don't know about common tools like
    > distutils, the odds are pretty good that it isn't your code itself
    > that is valuable to you- you're probably more interested in protecting
    > your idea about what the code should do. At least for now, that's
    > outside of the scope of technical solutions- discuss it with a lawyer,
    > not a programmer.
    >
    >>>
    >>>> disutils. Sounds familiar. I'm pretty sure I was using Py2Exe, and
    >>>> disutils
    >>>> might have been part of it.
    >>>
    >>> distutils.
    >>>
    >>> http://docs.python.org/library/distutils.html

    >>
    >> I don't see ;how distutils is going to solve this problem. Are you
    >> suggesting the program should be packaged? Why? I can just send it to him as
    >> py code. distutils looks like it's for library modules, e.g., functions like
    >> math.

    >
    > ...no. Distutils is handy because you could just bundle your
    > dependencies and hand them an easy-to-install package, which would be
    > a quick way to get everybody on the same page. Of course, depending on
    > the licenses those dependencies are under you might want to do even
    > more talking to a lawyer than I've previously suggested before you go
    > about trying to sell that bundle- I'm sure you wouldn't want to 'rip
    > off' great free projects like python and numpy.
    >
    > Geremy Condra

    Yes, code reversal programs have been around for many, many decades. Try
    one on MS Word or Adobe Acrobat. :)

    Is there a complete illustration of using disutils? Our only
    dependencies are on Python Org material. We use no commercial or
    licensed code.
    W. eWatson, Aug 6, 2010
    #12
  13. W. eWatson

    Peter Otten Guest

    W. eWatson wrote:

    > So you think Python is part of open software in terms of distributing a
    > "product"? So I should stick to C, where one can distribute programs w/o
    > revealing code details, and having a customer compile the code? It's


    No, I'm trying to make you reconsider what you're going to protect rather
    than how. Aren't your customers more interested in using your software
    rather than tinker with it?
    Peter Otten, Aug 6, 2010
    #13
  14. W. eWatson

    CM Guest

    On Aug 5, 9:50 pm, "W. eWatson" <> wrote:
    > In my on-again-off-again experience with Python for 18 months,
    > portability seems an issue.
    >
    > As an example, my inexperienced Python partner 30 miles away has gotten
    > out of step somehow. I think by installing a different version of numpy
    > than I use. I gave him a program we both use months ago, and he had no
    > trouble. (We both use IDLE on 2.5). I made a one character change to it
    > and sent him the new py file. He can't execute it. I doubt he has
    > changed anything in the intervening period.


    I'm curious: what was the one character change? And does your
    original
    program still work for him? Why did he install a different version
    of
    numpy if things were working for him?

    By the way, posting "x doesn't work" on a forum never gets you
    any help, because clairvoyance is not real :D. Posting actual error
    messages sample code does.

    > A further example. Months ago I decided to see if I could compile a
    > program to avoid such problems as above. I planned to satisfy that need,
    > and see if I could distribute some simple programs to non-Python
    > friends. I pretty well understand the idea,and got it working with a
    > small program. It seemed like a lot of manual labor to do it.


    As someone mentioned, you don't "compile" anything in Python. You
    can make a .exe file, though, using, as you know, py2exe. I find
    using
    GUI2Exe (which requires you have wxPython) to make things much easier
    and then if you want to be even fancier, use InnoSetup to make an
    installer.
    Once you get a working script in py2exe/GUI2Exe, it is usually a snap
    to
    make a new version of your .exe after changing your code a bit.

    As far as then updating your .exe files with your non-Python friends,
    you
    should search this newsgroup for Esky, which seems like a very nice
    idea
    for doing this very thing.

    Che
    CM, Aug 6, 2010
    #14
  15. W. eWatson

    CM Guest

    > As an example, my inexperienced Python partner 30 miles away has gotten
    > out of step somehow. I think by installing a different version of numpy
    > than I use. I gave him a program we both use months ago, and he had no
    > trouble. (We both use IDLE on 2.5). I made a one character change to it
    > and sent him the new py file. He can't execute it. I doubt he has
    > changed anything in the intervening period.


    I'm curious: what was the one character change? And does your
    original program still work for him? Why did he install a different
    version of numpy if things were working for him?

    By the way, posting "x doesn't work" on a forum never gets you
    any help, because clairvoyance is not real :D. Posting actual error
    messages sample code does.

    > A further example. Months ago I decided to see if I could compile a
    > program to avoid such problems as above. I planned to satisfy that need,
    > and see if I could distribute some simple programs to non-Python
    > friends. I pretty well understand the idea,and got it working with a
    > small program. It seemed like a lot of manual labor to do it.


    As someone mentioned, you don't "compile" anything in Python.
    You can make a .exe file, though, using, as you know, py2exe.
    I find using GUI2Exe (which requires you have wxPython) to make
    things
    much easier and then if you want to be even fancier, use InnoSetup to
    make an installer.

    Once you get a working script in py2exe/GUI2Exe, it is usually a snap
    to make a new version of your .exe after changing your code a bit.

    As far as then updating your .exe files with your non-Python friends,
    you should search this newsgroup for Esky, which seems like a very
    nice idea for doing this very thing.

    Che
    CM, Aug 6, 2010
    #15
  16. On Fri, Aug 6, 2010 at 10:58 AM, W. eWatson <> wrote:
    > Is there a complete illustration of using disutils? Our only dependencies
    > are on Python Org material. We use no commercial or licensed code.


    http://tinyurl.com/3yhwjfj

    Geremy Condra
    geremy condra, Aug 6, 2010
    #16
  17. On Fri, 06 Aug 2010 08:00:55 -0700, W. eWatson wrote:

    >>> I would think there are some small time and big time Python players
    >>> who sell executable versions of their programs for profit?

    >>
    >> Yes. What's your point?

    > That someone must know how to distribute them without having the source
    > code ripped off.


    That's what copyright law is for.

    If you think that distributing object code (instead of source code) is
    going to deter a serious hacker, you're deluded.

    Besides, I don't mean to be rude, but what makes you think anyone would
    care about stealing your code? If you think people are interested in
    stealing your code, you're almost certainly wrong. The world is full of
    coders who think their two-bit text editor or re-implementation of PacMan
    is the most precious, precious software in existence. The vast majority
    of them are wrong.


    --
    Steven
    Steven D'Aprano, Aug 6, 2010
    #17
  18. On Fri, 06 Aug 2010 10:35:38 -0700, W. eWatson wrote:

    > So you think Python is part of open software in terms of distributing a
    > "product"?


    Python itself *is* open source software. It doesn't *require* you to
    write open source software.

    > So I should stick to C, where one can distribute programs w/o
    > revealing code details


    No you can't. That's the point that you are missing. When you ship a
    compiled exe, you are still shipping code, and anyone serious about
    "ripping off" your ideas will not find that even the tiniest barrier to
    doing so.

    Microsoft never ship their code to Windows, and yet virus and malware
    authors regularly and rapidly analyse it well enough to not only work out
    what it does and how it does it, but to discover vulnerabilities that
    even Microsoft don't know about.

    If MS can't protect their code, what makes you think your .exe file is
    going to any better protected?



    --
    Steven
    Steven D'Aprano, Aug 6, 2010
    #18
  19. On Thu, 05 Aug 2010 18:50:14 -0700, W. eWatson wrote:

    > As an example, my inexperienced Python partner 30 miles away has gotten
    > out of step somehow. I think by installing a different version of numpy
    > than I use. I gave him a program we both use months ago, and he had no
    > trouble. (We both use IDLE on 2.5). I made a one character change to it
    > and sent him the new py file. He can't execute it. I doubt he has
    > changed anything in the intervening period.


    What does that mean? It crashes? It raises an exception? He double-clicks
    on it and nothing happens? What error does he get?

    What was the one character change? Have you tested it and are you sure it
    works, or are you just assuming it works?

    What OS are you using? How did you send it to him? Can he open the file
    in a text editor, and what does he see?


    > A further example. Months ago I decided to see if I could compile a
    > program to avoid such problems as above. I planned to satisfy that need,
    > and see if I could distribute some simple programs to non-Python
    > friends. I pretty well understand the idea,and got it working with a
    > small program. It seemed like a lot of manual labor to do it.


    I'm sorry, I don't fully understand what you think this is going to
    accomplish. A program compiled to object code is going to be dependent on
    the hardware platform, the operating system, and any libraries that may
    or may not be installed. Most likely the *exact* version of the
    libraries. Do the words "DLL Hell" mean anything to you? How is that an
    advantage of Python's source-code distribution?



    --
    Steven
    Steven D'Aprano, Aug 6, 2010
    #19
  20. On Fri, 06 Aug 2010 10:58:24 -0700, W. eWatson wrote:

    > Is there a complete illustration of using disutils? Our only
    > dependencies are on Python Org material. We use no commercial or
    > licensed code.


    Oh my, the sheer ignorance that sentence reveals.

    Python and the standard library *is* licensed. I mean, good grief, when
    you start up Python's interpreter, it even says:

    Type "help", "copyright", "credits" or "license" for more information.

    Similarly any C compiler you use will also be licensed. If it's not, you
    have no right to use it! (Unless you can find a public domain compiler,
    which I doubt exists, and even if one does, I doubt it will be very good.)



    --
    Steven
    Steven D'Aprano, Aug 6, 2010
    #20
    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. Raymond Arthur St. Marie II of III

    very Very VERY dumb Question About The new Set( ) 's

    Raymond Arthur St. Marie II of III, Jul 23, 2003, in forum: Python
    Replies:
    4
    Views:
    456
    Raymond Hettinger
    Jul 27, 2003
  2. Replies:
    7
    Views:
    906
  3. shanx__=|;-

    very very very long integer

    shanx__=|;-, Oct 16, 2004, in forum: C Programming
    Replies:
    19
    Views:
    1,595
    Merrill & Michele
    Oct 19, 2004
  4. Abhishek Jha

    very very very long integer

    Abhishek Jha, Oct 16, 2004, in forum: C Programming
    Replies:
    4
    Views:
    410
    jacob navia
    Oct 17, 2004
  5. Peter

    Very very very basic question

    Peter, Feb 8, 2005, in forum: C Programming
    Replies:
    14
    Views:
    506
    Dave Thompson
    Feb 14, 2005
Loading...

Share This Page