Using py2app to make a (distributable) Deluge.app

Support for Deluge on Apple Mac OS
frakk4d
New User
New User
Posts: 6
Joined: Sun Jun 27, 2010 3:08 pm

Using py2app to make a (distributable) Deluge.app

Postby frakk4d » Sun Jun 27, 2010 7:55 pm

Foreword: I'm a total coding newb and don't really know what I'm doing but figured I'd take a stab at this anyway! [Could have done some stupid stuff here, if anyone spots anything dumb, lemme know]

Okay, I followed the tutorial and managed to get Deluge working (if I run it from command line), so I figured I'd try to use py2app (a python > .app conversion package) to turn it into a fully function .app that can be redistributed easily.

Because I'm running Snow Leopard on a new mac, I had to do 'sudo port -u install py26-pyobjc +universal' to install python files that didnt throw i386/x86-64 compatibility errors, and I think this installs py2app as well.

I created a virtualenv called delugeapp. And did everything else (up to compiling) as was described in the tutorial, and renamed the setup.py file to Deluge.py

Then I created a setup.py file with 'py2applet --make-setup Deluge.py', and build Deluge.app (in alias mode) with 'python setup.py py2app -A'

When I try to run it with './dist/Deluge.app/Contents/MacOS/Deluge', it gives me the following error:

Code: Select all

Traceback (most recent call last):
  File "/Users/gellan/virtualenvs/delugeapp/src/deluge-1.2.3/dist/Deluge.app/Contents/Resources/__boot__.py", line 164, in <module>
    _run(('\x00\x00\x00\x00\x01(\x00\x02\x00\x00\x05MacHD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc8\x15\xcd\\H+\x00\x00\x00\x1a0\xed\tDeluge.py\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1a5y\xc7\xd4\x0e\xe0\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00I \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x08\x00\x00\xc8\x15\xbfL\x00\x00\x00\x11\x00\x08\x00\x00\xc7\xd4\x0e\xe0\x00\x00\x00\x0e\x00\x14\x00\t\x00D\x00e\x00l\x00u\x00g\x00e\x00.\x00p\x00y\x00\x0f\x00\x0c\x00\x05\x00M\x00a\x00c\x00H\x00D\x00\x12\x00=Users/gellan/virtualenvs/delugeapp/src/deluge-1.2.3/Deluge.py\x00\x00\x13\x00\x01/\x00\x00\x15\x00\x02\x00\r\xff\xff\x00\x00', '/Users/gellan/virtualenvs/delugeapp/src/deluge-1.2.3/Deluge.py'))
  File "/Users/gellan/virtualenvs/delugeapp/src/deluge-1.2.3/dist/Deluge.app/Contents/Resources/__boot__.py", line 160, in _run
    execfile(path, globals(), globals())
  File "/Users/gellan/virtualenvs/delugeapp/src/deluge-1.2.3/Deluge.py", line 29, in <module>
    from setuptools import setup, find_packages, Extension
  File "/Users/gellan/virtualenvs/delugeapp/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/__init__.py", line 2, in <module>
  File "/Users/gellan/virtualenvs/delugeapp/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/extension.py", line 2, in <module>
  File "/Users/gellan/virtualenvs/delugeapp/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/dist.py", line 5, in <module>
  File "/Users/gellan/virtualenvs/delugeapp/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/install.py", line 2, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/install.py", line 21, in <module>
    from site import USER_BASE
ImportError: cannot import name USER_BASE
2010-06-27 19:58:21.074 Deluge[51550:903] Deluge Error
2010-06-27 19:58:21.078 Deluge[51550:903] Deluge Error
An unexpected error has occurred during execution of the main script

ImportError: cannot import name USER_BASE
(delugeapp)Alistair-Gellans-MacBook:deluge-1.2.3 gellan$ ./dist/Deluge.app/Contents/MacOS/Deluge
Traceback (most recent call last):
  File "/Users/gellan/virtualenvs/delugeapp/src/deluge-1.2.3/dist/Deluge.app/Contents/Resources/__boot__.py", line 164, in <module>
    _run(('\x00\x00\x00\x00\x01(\x00\x02\x00\x00\x05MacHD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc8\x15\xcd\\H+\x00\x00\x00\x1a0\xed\tDeluge.py\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1a5y\xc7\xd4\x0e\xe0\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00I \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x08\x00\x00\xc8\x15\xbfL\x00\x00\x00\x11\x00\x08\x00\x00\xc7\xd4\x0e\xe0\x00\x00\x00\x0e\x00\x14\x00\t\x00D\x00e\x00l\x00u\x00g\x00e\x00.\x00p\x00y\x00\x0f\x00\x0c\x00\x05\x00M\x00a\x00c\x00H\x00D\x00\x12\x00=Users/gellan/virtualenvs/delugeapp/src/deluge-1.2.3/Deluge.py\x00\x00\x13\x00\x01/\x00\x00\x15\x00\x02\x00\r\xff\xff\x00\x00', '/Users/gellan/virtualenvs/delugeapp/src/deluge-1.2.3/Deluge.py'))
  File "/Users/gellan/virtualenvs/delugeapp/src/deluge-1.2.3/dist/Deluge.app/Contents/Resources/__boot__.py", line 160, in _run
    execfile(path, globals(), globals())
  File "/Users/gellan/virtualenvs/delugeapp/src/deluge-1.2.3/Deluge.py", line 29, in <module>
    from setuptools import setup, find_packages, Extension
  File "/Users/gellan/virtualenvs/delugeapp/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/__init__.py", line 2, in <module>
  File "/Users/gellan/virtualenvs/delugeapp/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/extension.py", line 2, in <module>
  File "/Users/gellan/virtualenvs/delugeapp/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/dist.py", line 5, in <module>
  File "/Users/gellan/virtualenvs/delugeapp/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/setuptools/command/install.py", line 2, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/install.py", line 21, in <module>
    from site import USER_BASE
ImportError: cannot import name USER_BASE
2010-06-27 20:52:46.254 Deluge[51653:903] Deluge Error
2010-06-27 20:52:46.258 Deluge[51653:903] Deluge Error
An unexpected error has occurred during execution of the main script

ImportError: cannot import name USER_BASE


This is so tricky! Google isn't much help with this issue either... I understand that USER_BASE is the root directory for all Python installations (which I'd assume to be /Users/gellan/virtualenvs/delugeapp/lib/ in my case), but I've got no idea how to set it. Was wondering if anyone here had any technical knowledge?

frakk4d
New User
New User
Posts: 6
Joined: Sun Jun 27, 2010 3:08 pm

Re: Using py2app to make a (distributable) Deluge.app

Postby frakk4d » Sun Jun 27, 2010 9:33 pm

I've had a bit of a further look into this and I think that maybe Deluge is just too complex a program to use with py2app. I'm not sure it was designed to be able to cope with creating apps that rely on python scripts for code compilation. Hopefully someone can prove me wrong though.

waeking
Member
Member
Posts: 16
Joined: Wed Nov 25, 2009 9:37 pm

Re: Using py2app to make a (distributable) Deluge.app

Postby waeking » Mon Jun 28, 2010 4:55 pm

Can you set

Code: Select all

USER_BASE = none

and see if it will compile and run

keepitcomplicated
Member
Member
Posts: 29
Joined: Wed Sep 29, 2010 1:40 pm

Re: Using py2app to make a (distributable) Deluge.app

Postby keepitcomplicated » Sun Jan 16, 2011 2:21 pm

Any news on this?

bcode
Member
Member
Posts: 13
Joined: Sat Jul 31, 2010 4:24 am

Re: Using py2app to make a (distributable) Deluge.app

Postby bcode » Fri Jan 21, 2011 10:44 pm

There is a user on the sig-python mailing list that figure out how to get around the USER_BASE issue for one of his apps... But he only talks about the solution in very high-level terms, no code examples and I'm not a Python coder (or much of a programmer at all), so I'm still a bit lost. But there does seem to be hope.


Return to “Mac OS”

Who is online

Users browsing this forum: No registered users and 1 guest