Python Portability--Not very portable?

W

W. eWatson

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.
 
G

geremy condra

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
 
W

W. eWatson

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.


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.
 
G

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
 
P

Peter Otten

W. eWatson said:
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.
 
W

W. eWatson

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

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.
 
P

Peter Otten

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


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
 
G

geremy condra

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.
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
 
W

W. eWatson

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.


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


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

W. eWatson

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.


...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.
 
P

Peter Otten

W. eWatson said:
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?
 
C

CM

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
 
C

CM

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
 
S

Steven D'Aprano

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.
 
S

Steven D'Aprano

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?
 
S

Steven D'Aprano

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?
 
S

Steven D'Aprano

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.)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top