You are not logged in.

#1 2013-02-28 21:16:34

Depado
Member
Registered: 2013-02-28
Posts: 49

[Solved] Create a python executable using Freeze

Hello,

I'm kind of new to python but I wanted to see how freeze worked.
First I'll try to explain my situation. Maybe some of you know the unofficial mega api developped by some guy I always forget the name (though I should not, it's not very respectful for him) which is called mega.py (just google it, you'll find it). So I decided to create a gui client for the fun. It looks pretty cool now and I'd like to see if I manage to create an executable file. Just to see. During my development I used PyGTK which I assume will be working for everyone using Linux with a DE.
After some researches I found out that using freeze.py I would be able to generate an executable file.

Here is my problem : it seems like I can't find the file "freeze.py" anywhere on my system. On python website it says that in debian, it's included in the python examples package (python2.7-examples) though I can't find it in aur/official repos. I also checked with a "find" command and it seems that there is no such file on my computer.
So I tried using cx_freeze which seems to be a "freeze.py" like.
I got two problems though.
First of all my python version is python3.3 and I use python2.7 to create that application (otherwise I would have used gobject introspection). (I don't know if that information is relevant though).
I used cxfreeze-quickstart which generated me a setup.py file. I opened it to see what was in there and here is the problem :
In this file (http://ompldr.org/vaG1iZA) instead of PyGTK was written "Win32Gui" so I changed it (anyway it wouldn't work with Win32Gui, am I right ?). Now the build fails and returns me this : cx_Freeze.freezer.ConfigError: no initscript named PyGTK (using python setup.py build)
So I tried to run python2.7 setup.py build which returns this : ImportError: No module named cx_Freeze.

Do you know what I'm doing wrong ? (sorry for the long post)
Thanks a lot everyone and forgive my mistakes, my english is quite bad.

Last edited by Depado (2013-03-02 10:32:19)

Offline

#2 2013-03-01 13:27:19

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: [Solved] Create a python executable using Freeze

You ask too much questions in the same long post. To find a particular file, use pkgfile:

[xxxxxx@xxxxxxxxx ~]$ pkgfile -vs freeze.py
extra/python-pip 1.2.1-2        /usr/lib/python3.3/site-packages/pip/commands/freeze.py
extra/python2-pip 1.2.1-2       /usr/lib/python2.7/site-packages/pip/commands/freeze.py

As for python related questions, it would be best to post it in news://comp.lang.python ; usually you get a a response within a few hours (or maximum 1-2 days).

Last edited by olive (2013-03-01 13:39:35)

Offline

#3 2013-03-01 13:58:02

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [Solved] Create a python executable using Freeze

I realize this isn't answering your question but, why do you want to create a Python executable? Every other Python application for Linux is distributed as a regular Python file... hmm

I briefly looked into creating a Python executable a couple years ago. What I remember learning is that it was non-standard, hackish, and unnecessary.

Offline

#4 2013-03-01 22:43:56

Depado
Member
Registered: 2013-02-28
Posts: 49

Re: [Solved] Create a python executable using Freeze

I don't know just a personnal goal. Seems easier to share the program, especially when using an api. I'm going to take a look at virtualenv.
I'm using an unnoficial api for mega.co.nz so I have to import an external file. I don't know if I can create a package using that (I guess so but not convinced though)
olive : I found these files... But I can't manage to make it work. ^^

Offline

#5 2013-03-02 10:00:02

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: [Solved] Create a python executable using Freeze

Depado wrote:

I don't know just a personnal goal. Seems easier to share the program, especially when using an api. I'm going to take a look at virtualenv.
I'm using an unnoficial api for mega.co.nz so I have to import an external file. I don't know if I can create a package using that (I guess so but not convinced though)
olive : I found these files... But I can't manage to make it work. ^^

I confirm that this feature is mostly for Windows. Every Linux distro provide python as one of its package and the usual way to share a program under Linux if to tell the users to install the dependencies. None of the python program are distributed in this way for Linux and eveb the binaries in Linux are (usually) not static and depends on some libraries. I would give the python program as is and tell the user to install python. Have a look at the package name under the main distributions and tell them the command they have to type.

Offline

#6 2013-03-02 10:31:59

Depado
Member
Registered: 2013-02-28
Posts: 49

Re: [Solved] Create a python executable using Freeze

Thanks a lot for all your answers. It helped me a lot ! smile

Offline

Board footer

Powered by FluxBB