473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Thoughts on running Python zips


As I am getting a larger collection of python program packages the idea of
saving them as zips is becoming increasingly attractive. The latest idea is
to launch them from a generic wrapper listed below. I have chosen to set the
default directory to the location of the zipfile because I usually have an
associated configuration inifile alongside.

Periodically the topic of program protection crops up. Some zip applications
allow password protection. If python did then one could possibly tie a
user's distribution to their network card MAC address. I guess the
commandline "-i" option could be programmatically overidden preventing
post-use access.

Colin Brown
PyNZ
--------------------------------------------------------------------
# A generic wrapper utility for running zipped python programs
#
# Usage: python [-options] RunZip.py app_path/application.zip [*args]
#
# application.zip is a package with main program named
# application.py in directory "application". Cwd is set
# to location of app_path. sys.args has "RunZip.py" removed.

import os, sys

zipf = ''
for path in sys.argv:
if path.find('RunZip.py') > -1:
myself = path
elif path.find('.zip') > -1:
zipf = path
break
sys.argv.remove(myself)
if zipf:
sys.path.insert(0,zipf)
name = os.path.splitext(os.path.basename(zipf))[0]
os.chdir(os.path.dirname(os.path.abspath(zipf)))
exec('from '+name+' import '+name)

Jul 18 '05 #1
0 1155

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Dave Benjamin | last post by:
Hey good people, I've been doing a lot of simultaneous Jython and CPython programming lately, and just wanted to say, with no intended ill will toward any of the individuals who have been...
39
by: Marco Aschwanden | last post by:
Hi I don't have to talk about the beauty of Python and its clear and readable syntax... but there are a few things that striked me while learning Python. I have collected those thoughts. I am...
24
by: huy | last post by:
Hi, Just wondering if there were any plans (or existing projects) similar to Java webstart for Python. I think this would be a boon for python. I would love to start my new project using Python...
10
by: Larry Hastings | last post by:
I'm an indie shareware Windows game developer. In indie shareware game development, download size is terribly important; conventional wisdom holds that--even today--your download should be 5MB or...
1
by: m3zmeriz3d | last post by:
i typed a function to enter data into a file to be recalled later, now i have done something here and as soon as this function begins it skips the first 'zips' getline and makes it a blank space and...
4
by: fdu.xiaojf | last post by:
Hi, I just want to upgrade my python version from 2.4.3 to 2.4.4,do I need to uninstall python 2.4.3 first ? I'd rather not to do so, because I have installed some other python packages for...
12
by: Jack | last post by:
Since the full installation of Python (from either the standard installer or ActiveState installer) is too big for my intended use, I'd like to build a custom distribution of Python for Windows...
1
by: James T. Dennis | last post by:
I've been thinking about the Python mmap module quite a bit during the last couple of days. Sadly most of it has just been thinking ... and reading pages from Google searches ... and very little...
5
by: T_T | last post by:
Hi, I'm just starting to learn some Python basics and are not familiar with file handling. Looking for a python scrip that zips files. So aaa.xx bbb.yy ccc.xx should be zipped to aaa.zip...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.