
July 18th, 2005, 10:56 PM
| | | compatbility of .pyc files
I have a requirement to prevent 'accidental' tampering
with some software written in Python. If I ensure that all
of the modules concerned are compiled into .pyc's, and remove
the .py's to another location, then I should be safe until
the next upgrade of the Python interpretter.
My questions:
Are the .pyc's usable without recompilation between 'minor'
releases of the interpretter (e.g., 2.3.1 -> 2.3.2 -> etc)?
I presume that the .pyc's are NOT compatible
across more major releases (e.g., 2.3.x -> 2.4.x)?
Is there a hard and fast rule about compatibility across
releases that I can rely on? | 
July 18th, 2005, 10:56 PM
| | | basic tkinter/Windows question
I find myself having to write some code on Windows :-(. To alleviate
the pain, at least I get to use Python for some of it.
I'm trying to write a simple application, say "eggs.py". It pops a
tkinter gui and lets the user do some stuff. The system has Python
installed so I don't care about wrapping it in a .exe file or anything
like that. But I'd like to make a desktop icon for eggs.py and let the
user double-click it and run the app without also getting a DOS box on
the screen.
Is there a simple way to do that? I didn't see anything in the Python
docs about it. I suspect that this is really a dumb Windows question,
but I avoid Windows whenever I can, so most anything I can ask about it
is probably dumb.
Thanks much. | 
July 18th, 2005, 10:56 PM
| | | Re: compatbility of .pyc files
Blair Hall wrote:[color=blue]
> Are the .pyc's usable without recompilation between 'minor'
> releases of the interpretter (e.g., 2.3.1 -> 2.3.2 -> etc)?[/color]
Yes.
[color=blue]
> I presume that the .pyc's are NOT compatible
> across more major releases (e.g., 2.3.x -> 2.4.x)?[/color]
Correct.
[color=blue]
> Is there a hard and fast rule about compatibility across
> releases that I can rely on?[/color]
Each Python version uses a "magic", as returned by
imp.get_magic(). Whenever that changes (and it will at
worst change between 2.x, 2.x+1), you need to recompile
the .pyc files.
If you pass it an "old" pyc file (i.e. one with an
incorrect magic), Python will silently ignore the .pyc
file, use the source, and attempt to regenerate the
..pyc file.
Regards,
Martin | 
July 18th, 2005, 10:56 PM
| | | Re: compatbility of .pyc files
On Wed, 23 Feb 2005 13:31:12 +1300, Blair Hall wrote:
[color=blue]
> I have a requirement to prevent 'accidental' tampering
> with some software written in Python. If I ensure that all
> of the modules concerned are compiled into .pyc's, and remove
> the .py's to another location, then I should be safe until
> the next upgrade of the Python interpretter.[/color]
Depending on how "scare quote-y" the scare quotes are, if you're really
out to avoid accidental tampering, why not just set the *.py files to
read-only?
Beyond that you get into rapidly diminishing returns; removing the .py
files is feasible if you have some semblance of control over the
interpreter, beyond that and you're usually better off with a binding
legal agreement. | 
July 18th, 2005, 10:56 PM
| | | Re: basic tkinter/Windows question
Paul Rubin wrote:[color=blue]
> I find myself having to write some code on Windows :-(. To alleviate
> the pain, at least I get to use Python for some of it.
>
> I'm trying to write a simple application, say "eggs.py". It pops a
> tkinter gui and lets the user do some stuff. The system has Python
> installed so I don't care about wrapping it in a .exe file or anything
> like that. But I'd like to make a desktop icon for eggs.py and let the
> user double-click it and run the app without also getting a DOS box on
> the screen.[/color]
Rename the file "eggs.py" to "eggs.pyw" and create a shortcut to that
file. The file will be opened using pythonw.exe instead of python.exe.
--
Vincent Wehren
[color=blue]
>
> Is there a simple way to do that? I didn't see anything in the Python
> docs about it. I suspect that this is really a dumb Windows question,
> but I avoid Windows whenever I can, so most anything I can ask about it
> is probably dumb.
>
> Thanks much.[/color] | 
July 18th, 2005, 10:56 PM
| | | Re: basic tkinter/Windows question
Paul Rubin wrote:[color=blue]
> I find myself having to write some code on Windows :-(. To alleviate
> the pain, at least I get to use Python for some of it.
>
> I'm trying to write a simple application, say "eggs.py". It pops a
> tkinter gui and lets the user do some stuff. The system has Python
> installed so I don't care about wrapping it in a .exe file or anything
> like that. But I'd like to make a desktop icon for eggs.py and let the
> user double-click it and run the app without also getting a DOS box on
> the screen.
>
> Is there a simple way to do that? I didn't see anything in the Python
> docs about it. I suspect that this is really a dumb Windows question,
> but I avoid Windows whenever I can, so most anything I can ask about it
> is probably dumb.
>
> Thanks much.[/color]
renaming the eggs.py to eggs.pyw will tell windows to use pythonw.exe
to start this python file (and will not open a console) You can then
create a shortcut in the normal way
Martin |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over network members.
|