473,323 Members | 1,622 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,323 software developers and data experts.

Distributing Python Programs

Hello,

I have written a program that requires some modules from pyxml to run. It will run fine on my pc but if I try to run it on another pc with python but without the pyxml modules, I will get import errors. What is the best way to run my program on other pc's without having to install dependent modules on them?

I have tried cx_freeze, freeze.py and am having issues with those. Is there any other alternatives? I am using python 2.5 and OpenSuse 10.1. Thanks.
Mar 11 '08 #1
6 1520
jlm699
314 100+
You can either try building a distributable program, or literally taking the inherited functions that you use and put the code into your own program...

Why are you trying to do this? If you would like to create distributions (like .exe ) you should look into py2exe
Mar 11 '08 #2
I have tried cx_freeze and freeze.py to create standalone programs but am having issues with those two methods that I am still working on. I cannot use py2exe because I am running linux.
Mar 11 '08 #3
jlm699
314 100+
Oh yeah, sorry.. missed that.

Have you tried this... ?

http://www.linux.com/feature/118439
Mar 11 '08 #4
I'll try to clarify my situation and what I am trying to achieve...
I would like to put my script on a shared directory where all pc's on the network will be able to access. They should all be able to execute the script without having to install additional modules. All the pc's have python installed but do not have pyxml, which the script needs. I don't want to install pyxml on each pc. In this situation distutils is not the ideal solution.

Is it possible to copy the entire pyxml module into the same folder as my script and modify the import statements? Will the scirpt then look in this folder as opposed to the default python install directory? And how exactly will the import statement look like?

Thanks for the help so far.
Mar 11 '08 #5
jlm699
314 100+
Is it possible to copy the entire pyxml module into the same folder as my script and modify the import statements? Will the scirpt then look in this folder as opposed to the default python install directory? And how exactly will the import statement look like?
I'm not entirely positive but I'm pretty sure that the import command will look in the current working directory before looking elsewhere (python install dir)... so you shouldn't have to change the import command at all. As long as it's in the working directory it'll work without a hitch.

It may not look there FIRST per say, but if it finds it there after a fail in the default install directory it'll still work seamlessly. You could always modify the sys.path variable before doing the import.

ie,
Expand|Select|Wrap|Line Numbers
  1. import sys, os
  2. sys.path.insert(0, os.getcwd()) # this could also be another path where pyxml is contained
  3. import pyxml
  4. ...
  5.  
Mar 11 '08 #6
Well that was pretty straight forward... Thanks jlm699!
Mar 11 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: NEWS | last post by:
Can I install Python on a networked server and have any user run Python programs without having to go through the 9Mb client install? What are my options for distributing Python programs to my...
5
by: Jiri Barton | last post by:
Hi, I'd like to be able to distribute some python modules of my system (plugins) without the source. So far, I have done this by including only the *.pyc files. However, I have recently found...
6
by: Jason | last post by:
A non-python programming friend of mine has said that any programs made with Python must be distributed with, or an alternative link, to the source of the program. Is this true?
2
by: RickMuller | last post by:
I really appreciate the ease that the distutils make distributing Python modules. However, I have a question about using them to distribute non-Python (i.e. text) data files that support Python...
10
by: John Phelan | last post by:
I read an article by, by Mike Groh, in Access-VB-SQL Advisor Magazine, Week 37 that concerns me quite a bit on distributing Access Applications commercially. First I need to describe a "commercial...
2
by: Finger.Octopus | last post by:
Hello, It has been such a painful thing for me. As I made a program to encrypt files, now I want to distribute that program over other computers. I created .EXE file with py2exe but the "dist"...
11
by: Tina I | last post by:
Hi list, Is there a preferred way to distribute programs that depends on third party modules like PyQt, Beautifulsoup etc? I have used setuptools and just having the setup script check for the...
4
by: Robert Dailey | last post by:
Hi, I'm creating a set of command-line tools using Python. These tools manage resources for a game I'm working on. However, many people that will be using these tools will not want to install...
5
by: xkenneth | last post by:
Hi All, I'll shortly be distributing a number of python applications that use proprietary. The software is part of a much larger system and it will need to be distributed securely. How can i...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.