A quick question about python

moving a file after importing

Page 1 of 1

6 Replies - 980 Views - Last Post: 04 February 2009 - 10:12 AM Rate Topic: -----

#1 gl3thr0  Icon User is offline

  • D.I.C Regular

Reputation: 19
  • View blog
  • Posts: 319
  • Joined: 27-October 07

A quick question about python

Posted 01 January 2009 - 06:46 PM

hey
i just finished a python project that takes a folder full of images and merges them together to form a collage. However, i want to use this on another computer... normally i would just move the .py or .pyc file around. But in order to get the imaging to work i download an external library (Python Imaging Library (PIL)). So when i move the file around i get several importing errors.

From the imaging library i imported
Image.py
nd used the methods: paste(),new(),open(),save()

i tried simply adding copying the files that were required, but eventually it said something needed to be installed and simply moving the file into my project area did not work

ive tried google.. but im not entirely sure what to type in :P so so far it has been fairly unsuccessful

oh nd im on vista right now, but i would like to move the file to a mac... just in case tht makes a difference :P

anyway if u know how to do this or what its called that would help a lot.

ill attach the code i have so far.. its a little bulky as ive only had the last few hours to work on it so i had no time to clean it up.... (the command line arguments are for later... im gonna hv a java gui call the python file... cant stand python gui code :P )

thanks

Attached File(s)


This post has been edited by gl3thr0: 01 January 2009 - 07:02 PM


Is This A Good Question/Topic? 0
  • +

Replies To: A quick question about python

#2 bodom658  Icon User is offline

  • Villiage Idiom
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,123
  • Joined: 22-February 08

Re: A quick question about python

Posted 02 January 2009 - 09:12 PM

u'll probably need to install whatever you need to there, as part of the installation process for your app, since the code is compiled as it is executed with python.
Was This Post Helpful? 0
  • +
  • -

#3 gl3thr0  Icon User is offline

  • D.I.C Regular

Reputation: 19
  • View blog
  • Posts: 319
  • Joined: 27-October 07

Re: A quick question about python

Posted 03 January 2009 - 12:42 AM

theres no way to bundle the dependencies with the program?

what about "frozen binaries" ?
Was This Post Helpful? 0
  • +
  • -

#4 gl3thr0  Icon User is offline

  • D.I.C Regular

Reputation: 19
  • View blog
  • Posts: 319
  • Joined: 27-October 07

Re: A quick question about python

Posted 05 January 2009 - 04:10 AM

come on.. some1 has to have tried this???

what if u use the GUI libraries like WXpython ??? how do u allow the program to be usable by "outsiders"
Was This Post Helpful? 0
  • +
  • -

#5 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5831
  • View blog
  • Posts: 12,683
  • Joined: 16-October 07

Re: A quick question about python

Posted 05 January 2009 - 06:08 AM

The fundamental problem is that the PIL package has external components; stuff that needs to be compiled. That means you can't easily wad it up with your own package, because compilation still needs to happen.

So, you have an application and it has a dependency? Two, in fact. Python needs the client to have python installed, so they already got that far. Make the intended user install PIL as well? They've already gone far enough to install python, after all.

Or use a package you feel is more potable. For imaging I'd probably use ImageMagick. It has a ton of bindings, can do pretty much anything with an image you'd want, and also has command line executables. Even if you don't like the bindings, you can use whatever language you like to construct the CLI calls.
Was This Post Helpful? 1
  • +
  • -

#6 gl3thr0  Icon User is offline

  • D.I.C Regular

Reputation: 19
  • View blog
  • Posts: 319
  • Joined: 27-October 07

Re: A quick question about python

Posted 05 January 2009 - 08:23 AM

hmm okay :D

thanks
Was This Post Helpful? 0
  • +
  • -

#7 dnr101  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 04-February 09

Re: A quick question about python

Posted 04 February 2009 - 10:12 AM

Not sure if this is exactly what you're looking for, but you could try making your script into an executable as in, py2exe (see http://www.py2exe.org/) I haven't tried it myself, but it seems pretty straight forward.
-D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1