vendredi 28 août 2015

Python - Windows Service Distribution - Sqlite3 vs SQLAlchemy - Packaging (Setup.py)

I am Using Python 3.4, 64 Bit

I created a internal Proof Of Concept recently to build and deploy and install a windows service. The service is coded in Python, and was working when using sqlite3 module. Using the below setup.py

Setup.py (sqlite3 working)

from distutils.core import setup
import py2exe


# Setup.py for Windows Service. Works with Py2exe

#
class Target:
    def __init__(self, **kw):
        self.__dict__.update(kw)
        # for the versioninfo resources
        self.version = "0.5.0"
        self.company_name = ""
        self.copyright = "no copyright"
        self.name = "Test22"


myservice = Target(
    description = 'Edit Logon Service',
    modules = ['Logon_Service'],
    cmdline_style='pywin32'
)

setup(
    options = {"py2exe": {"compressed": 1, "bundle_files": 1} },
    zipfile = None,
    service=[myservice]
)

I recently tried to update the service to the more robust SQLAlchemy Package. When Building the service with SQLAlchemy, with the same Setup.py, py2exe works, but when executing the .exe, results in the following error

Traceback (most recent call last):
  File "boot_service.py", line 45, in <module>
TypeError: Objects of type '_FunctionGenerator' can not be converted to Unicode.

I have tried adding "includes":"sqlite3","sqlalchemy.dialects.sqlite" as well as a variety of combinations between sqlalchemy sqlalchemy.orm sqlalchemy.ext.declarative etc.,

The idea is that the service will eventually be using an UNDETERMINED RDBMS , which sqlite3 module will inevitably need to be replaced. The service should be buildable as a .exe to distribute to corporate machines. The corporate machines will execute the .exe with proper commands, but python will not available, and therefore must be built as .exe

Thanks for reading!

Aucun commentaire:

Enregistrer un commentaire