English 中文(简体)
python app to exe not working on WinSRV2003
原标题:

I created little app for sending out emails when something is wrong with server. Used py2exe to create exe file. While it is works absolutely fine on Win7 i have problems with running it on WinSRV2003. I do not believe that it has something to do with code itself. Please see imports below

import pyodbc, sys, smtplib, os
from datetime import date
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
import email.iterators
import email.generator

setup.py file:

from distutils.core import setup
import py2exe
import modulefinder

modulefinder.AddPackagePath("mail.mime", "base")
modulefinder.AddPackagePath("mail.mime", "multipart")
modulefinder.AddPackagePath("mail.mime", "nonmultipart")
modulefinder.AddPackagePath("mail.mime", "audio")
modulefinder.AddPackagePath("mail.mime", "image")
modulefinder.AddPackagePath("mail.mime", "message")
modulefinder.AddPackagePath("mail.mime", "application")

setup(console=[ capfile_tester.py ],
    options = { "py2exe": { "includes": "decimal, datetime, email" } })

And also one line from py2exe output that might be interesting

The following modules appear to be missing [ _scproxy ]

Error message when trying to start it:

This application has failed to start because application configuration is incorrect. Reinstalling the application may fix this problem.

What came to my mind is could it missing some registry keys taht would allow app to run?

问题回答

A search on _scproxy seems to indicate that _scproxy is a new module in 2.6. Perhaps somehow Python 2.5 is involved? py2exe is supposed to make a completely self-contained executable, so I don t see how that s possible, though.

Another possibility is that _scproxy depends on a dll that isn t available in Windows 2003? Have you tried running your program without py2exe on Win2003?

I d say this is a missing DLL s problem. You should check and see the DLL s your application bundles ( or presumes to exist on the target computer ). I think you can do that with the depends.exe that comes with Visual Studio.

EDIT: I just remembered. Make sure you run py2exe with a Python 2.5 installation. The 2.6 had some bugs and that made the exe not work on several machines.

Googling for your "this application has failed to start..." message suggests strongly this is a DLL problem, probably with msvcp80.dll and friends. This is a very common occurrence with recent Windows/Python/py2exe given how MS keeps changing MSVCC libraries etc. Different Python versions are linked with different libraries and if they aren t pre-installed on your target machine you can get problems like this. Sometimes installing the appropriate redistributable package from MS works.

Note that the py2exe warnings, in this case about _scproxy, can almost always be ignored. It s very common to get what amount to spurious reports of missing modules like that. 95% of the time we can ignore them, even when we see literally dozens of modules "missing".

I had a similar problem where COM objects were involved. Maybe that s the case here, too. This description solved my problems. My software would then run on different Windows versions, which it before would not.





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签