[BioPython] Problems building biopython-based script with py2exe

Leighton Pritchard lpritc at scri.sari.ac.uk
Thu Jan 29 13:30:35 EST 2004


Hi,

I have a script:

### gentest.py

from Bio import GenBank

gi_list = ['AF339445', 'AF339444', 'AF339443', 'AF339442', 'AF339441']
record_parser = GenBank.FeatureParser()             # GenBank file parser
ncbi_dict = GenBank.NCBIDictionary(parser = record_parser,
                                    database = "nucleotide") # Dict for 
accessing NCBI

count = 1
for accession in gi_list:
     print "Accessing GenBank for %s... (%d/%d)" % (accession, count, 
len(gi_list))
     try:
         record = ncbi_dict[accession]           # Get record as SeqRecord
         RECORDS.append(record)                  # Put records in local list
     except:
         print "Accessing record %s failed" % accession
     count += 1

###

Which seems fairly simple and straightforward.  However, when I try to turn 
this into a standalone executable with py2exe with the script below, the 
following problems occur:

### setup.py

from distutils.core import setup
import py2exe, sys

setup (name = "genbank2excel",
        version = "0.10",
        url = r'http://bioinf.scri.sari.ac.uk/lp/index.shtml',
        author = "Leighton Pritchard",
        console = ["gentest.py"])

###

Problem 1: apparently missing modules

[partial stdout from python setup.py py2exe]
[...]
*** copy dlls ***
copying E:\APPLIC~1\PYTHON~2\lib\site-packages\py2exe\run.exe -> 
E:\Data\CVSWorkspace\genbank2excel\genbank2excel\dist\gentest.exe
The following modules appear to be missing
['mindy', 'mxTextTools.__version__']

Problem 2: The compiled program doesn't seem to like the os.listdir call in 
Bio/__init__.py line 52 (55 here because of some exploratory debugging 
lines I inserted), and doesn't think that the Bio/config folder in the 
library.zip file that py2exe generates is a file or directory...

[complete stderr traceback from running the resulting gentest.exe]
Traceback (most recent call last):
   File "gentest.py", line 1, in ?
   File "Bio\__init__.pyc", line 68, in ?
   File "Bio\__init__.pyc", line 55, in _load_registries
WindowsError: [Errno 3] The system cannot find the path specified: 
'E:\\Data\\CVSWorkspace\\genbank2excel\\genbank2excel\\dist\\library.zip\\Bio\\config/*.*'

Can any of you help or advise me on this?  Am I missing something obvious?

Thanks in advance,


Dr Leighton Pritchard AMRSC
D104, PPI, Scottish Crop Research Institute
Invergowrie, Dundee, DD2 5DA, Scotland, UK
E: lpritc at scri.sari.ac.uk
T: +44 (0)1382 568579           F: +44 (0)1382 568578
PGP key FEFC205C: http://www.keyserver.net http://pgp.mit.edu




More information about the BioPython mailing list