DrPython and py2exe

M

mk

Hello,

I'm trying to get DrPython to edit .py file on double-click on Windows.

Sure, I can use trivial .bat file to open DrPython with file as
argument. But the irritating thing is that DOS window stays open until
particular instance of DrPython isn't closed.

py2exe to rescue. I have modified DrPython's setup.py:


setup(name='drpython.exe',
version=MY_VER,
description=description[0],
long_description=description[1],
classifiers = filter(None, classifiers.split('\n')),
author=AUTHOR,
author_email=AUTHOR_EMAIL,
url=URL,
platforms = "any",
license = 'GPL',
packages=[ MY_NAME ],
package_dir={ MY_NAME : '.' },
package_data={ MY_NAME : DATA },
scripts=['postinst.py'],
windows=['drpython.py'],
)

py2exe builds application, but when I start it, I get this in the log file:

Traceback (most recent call last):
File "drpython.py", line 46, in <module>
File "wxversion.pyc", line 152, in select
wxversion.VersionError: Requested version of wxPython not found

I'm guessing this is because py2exe doesn't package wxPython together
with the app.

Since this topic is interesting for me anyway (i.e. how to transform
wxPython app using py2exe into Windows executable), would someone please
reply on how to do it?

Thanks,
mk
 
I

imageguy

But the irritating thing is that DOS window stays open until
particular instance of DrPython isn't closed.


This is a relatively simple fix I think.
You can change the extension of the drPython.py to drpython.pyw and
the python windows
executable (pythonw.exe) will launch the program instead of the
traditional
executable (python.exe).

Traceback (most recent call last):
   File "drpython.py", line 46, in <module>
   File "wxversion.pyc", line 152, in select
wxversion.VersionError: Requested version of wxPython not found

check out the wiki on 'multi version installs'.
http://wiki.wxpython.org/MultiVersionInstalls

drPython is probably selecting a specific version of wxpython and
py2exe doesn't like it or
can't find it. Once you solve that, py2exe will work fine with
wxpython.
 
M

mk

imageguy said:
drPython is probably selecting a specific version of wxpython and
py2exe doesn't like it or
can't find it. Once you solve that, py2exe will work fine with
wxpython.

Thanks, drPython was indeed making use of wxversion.select. What's
strange is that it was selecting apparently correct version:

import wxversion
wxversion.select('2.8')

I put this in setup.py:

import wxversion
wxversion.select("2.8.9.1")
import wx

...and it worked.

Regards,
mk
 
A

Armin

Hello all,

I have frozen a running application which is using SQLite with py2exe.

When I start the exe file I see in the log file of the exe:

Traceback (most recent call last):
File "dpconf.py", line 666, in ?
File "dpconf.py", line 251, in __init__
File "sqlite\main.pyc", line 255, in execute
_sqlite.DatabaseError: no such table: genslaveopt

The table exist in the database file ... no problem with the plain
python version.

How can I solve that problem ??

Best Regards

--Armin
 
G

Gabriel Genellina

I have frozen a running application which is using SQLite with py2exe.
When I start the exe file I see in the log file of the exe:
Traceback (most recent call last):
File "dpconf.py", line 666, in ?
File "dpconf.py", line 251, in __init__
File "sqlite\main.pyc", line 255, in execute
_sqlite.DatabaseError: no such table: genslaveopt

The table exist in the database file ... no problem with the plain
python version.

Did you solve this problem? As you posted 4 related messages and the last
one might imply a solution to this first one...
 
A

Armin

Gabriel said:
Did you solve this problem? As you posted 4 related messages and the
last one might imply a solution to this first one...

Yes, the distutil option 'data_files' failed to copy the database files
to the dist directory. All dbopen calls have created empty db files ...

--Armin

PS: any comments on the data_files issue ??
 
G

Gabriel Genellina

Yes, the distutil option 'data_files' failed to copy the database files
to the dist directory. All dbopen calls have created empty db files ...

PS: any comments on the data_files issue ??

Yes: read the section "Installing Additional Files" in the "Distributing
Python Modules" document
http://docs.python.org/distutils/setupscript.html#installing-additional-files

Right at the end: "To install data files directly in the target directory,
an empty string should be given as the directory."

setup(...,
data_files=[
('', ['list/of/file/names',
'perhaps/including/source/directory']),
]
)
 
A

Armin

Gabriel said:
Right at the end: "To install data files directly in the target
directory, an empty string should be given as the directory."

setup(...,
data_files=[
('', ['list/of/file/names',
'perhaps/including/source/directory']),
]
)
Yes ... so far the theory :)

As posted before ... set's my script (python 2.3):

from distutils.core import setup
import py2exe

setup(windows=['dpconf.py'],
data_files=[ "", ["proj_db","gsd_db","dachs2.xbm"]]
)

When I create the distribution I got the following err msg:

*** copy data files ***
warning: install_data: setup script did not provide a directory for ''
-- installing right in 'C:\pyDPCONF.2.3-dev\dist'
error: can't copy '': doesn't exist or not a regular file

Looks a little bit inconsistent ?

--Armin
 
T

Thomas Heller

Armin said:
As posted before ... set's my script (python 2.3):

from distutils.core import setup
import py2exe

setup(windows=['dpconf.py'],
data_files=[ "", ["proj_db","gsd_db","dachs2.xbm"]]
)

When I create the distribution I got the following err msg:

*** copy data files ***
warning: install_data: setup script did not provide a directory for ''
-- installing right in 'C:\pyDPCONF.2.3-dev\dist'
error: can't copy '': doesn't exist or not a regular file

From the Python docs (chapter 'writing the setup script):

"""
data_files specifies a sequence of (directory, files) pairs in the following way:

setup(...,
data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2.gif']),
('config', ['cfg/data.cfg']),
('/etc/init.d', ['init-script'])]
)
"""

So, it looks like you should use
setup(windows=['dpconf.py'],
data_files=[("", ["proj_db","gsd_db","dachs2.xbm"])]
^ ^

Thomas
 
G

Gabriel Genellina

Gabriel said:
En Fri, 30 Jan 2009 09:50:08 -0200, Armin <[email protected]> escribió:
Right at the end: "To install data files directly in the target
directory, an empty string should be given as the directory."
setup(...,
data_files=[
('', ['list/of/file/names',
'perhaps/including/source/directory']),
]
)
Yes ... so far the theory :)

As posted before ... set's my script (python 2.3):

You didn't tell us that you were using version 2.3 -- it's important, as
the current stable releases are 2.6 and 3.0. Anyway, this should work in
2.3 too.
from distutils.core import setup
import py2exe

setup(windows=['dpconf.py'],
data_files=[ "", ["proj_db","gsd_db","dachs2.xbm"]]
)

Comparing my example and yours, you lack a parenthesis level:

setup(windows=['dpconf.py'],
data_files=[("", ["proj_db","gsd_db","dachs2.xbm"])]
)
When I create the distribution I got the following err msg:

*** copy data files ***
warning: install_data: setup script did not provide a directory for ''
-- installing right in 'C:\pyDPCONF.2.3-dev\dist'
error: can't copy '': doesn't exist or not a regular file

Looks a little bit inconsistent ?

O thou of little faith, try again...
 
A

Armin

Hello,

Thanks to all ... it's working now !

Google isn't always your friend :) I found in the net a lot but wrong
examples for specification of "data_files". Now I have the correct one.

Best Regards

--Armin



Gabriel said:
Gabriel said:
En Fri, 30 Jan 2009 09:50:08 -0200, Armin <[email protected]> escribió:
Right at the end: "To install data files directly in the target
directory, an empty string should be given as the directory."
setup(...,
data_files=[
('', ['list/of/file/names',
'perhaps/including/source/directory']),
]
)
Yes ... so far the theory :)

As posted before ... set's my script (python 2.3):

You didn't tell us that you were using version 2.3 -- it's important, as
the current stable releases are 2.6 and 3.0. Anyway, this should work in
2.3 too.
from distutils.core import setup
import py2exe

setup(windows=['dpconf.py'],
data_files=[ "", ["proj_db","gsd_db","dachs2.xbm"]]
)

Comparing my example and yours, you lack a parenthesis level:

setup(windows=['dpconf.py'],
data_files=[("", ["proj_db","gsd_db","dachs2.xbm"])]
)
When I create the distribution I got the following err msg:

*** copy data files ***
warning: install_data: setup script did not provide a directory for ''
-- installing right in 'C:\pyDPCONF.2.3-dev\dist'
error: can't copy '': doesn't exist or not a regular file

Looks a little bit inconsistent ?

O thou of little faith, try again...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,169
Latest member
ArturoOlne
Top