Re: Any way to not create .pyc files?
- From: Paul McNett <p@xxxxxxxxxxxx>
- Date: Thu, 09 Jun 2005 10:43:19 -0700
Lonnie Princehouse wrote:
Is there any way to run Python WITHOUT trying to create .pyc files (or .pyo) or to have Python not attempt to import the .pyc files it finds?
You could roll your package into a zip archive and then import that. For instance, keep your main.py out of the archive and put everything else in. Then, at the top of main.py:
import sys
sys.path.insert("network_path/package.zip")import package # do normal stuff with package here.
As long as you zipped up the package will all .pyc and .pyo files removed, Python will have no choice but to compile the files every time they are imported - unless I'm grossly mistaken Python won't put the pyc files into the zip archive, or modify any that were there already.
As far as the maintenance headache of distributing updated copies to individual workstations, IMO this just requires a little forethought and then it isn't a headache at all. Instead of the users starting the application directly, they could start a starter application that checks with the server to determine if local files need to be updated, and if so grab them and then start the main app. This actually removes headaches in the Windows world, where you can't drop-in updates to programs that are currently running.
What I've done in the past adds on to the starter application idea, and has the main application check to see if there are updates to the starter application, and if so pull those changes down upon exit of the main application. I just saved the file locations locally in an INI file.
-- Paul McNett http://paulmcnett.com
.
- Follow-Ups:
- Re: Any way to not create .pyc files?
- From: Lonnie Princehouse
- Re: Any way to not create .pyc files?
- References:
- Any way to not create .pyc files?
- From: Lonnie Princehouse
- Any way to not create .pyc files?
- Prev by Date: Re: Python as CGI on IIS and Windows 2003 Server
- Next by Date: Re: Start application & continue after app exits
- Previous by thread: Any way to not create .pyc files?
- Next by thread: Re: Any way to not create .pyc files?
- Index(es):
Relevant Pages
|