Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8580841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:54:45+00:00 2026-06-11T20:54:45+00:00

I have been running the python code below for approx a year now. But

  • 0

I have been running the python code below for approx a year now. But am about to move onto a new job. In order to make things easy for the department I am leaving, I want to compile this code into a .exe file.

I have tried compiling against Python 2.5 and 2.7 with the same results.

But when when running the exe file I get the following error

H:\development\DMS_Import_Data\dist>import_data.exe
Run Live or Development Import (L = Live, D = Dev, X = Exit):l
5:3:2012 10:56 Opening Live Database...
5:3:2012 10:56 Assuming Database already open
5:3:2012 10:56 Importing latest DMS Data...
Traceback (most recent call last):
File "import_data.py", line 79, in <module>
File "import_data.py", line 46, in run
File "<COMObject Access.Application>", line 2, in run
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, u'You made
an illegal function call.', None, -1, -2146820336), None)

Here is the python code. The problem is with the last line in this block datatype = conn.run(“import data”)

import win32com.client
import pythoncom
import time
import datetime
import os
import string
class ProcessDMSData:
    sleepTime = 3600
    ref_date = ''

    def set_ref_date(self,ref_date):

        self.ref_date = ref_date



    def run(self):

        run_type = ""

        while True:
            pythoncom.CoInitialize()
            check_values = ["L", "D", "X"]
            while run_type.upper() not in check_values:           
                run_type = raw_input ("Run Live or Development Import (L = Live, D = Dev, X = Exit):")
            if run_type.upper() == "L":

                update_type = "Live"

                database_path = "G:\\Eurofighter programme Management\\1.PM Reporting\\Production Tracking Database\\booking_planeset_tracker_data.mdb"

            elif run_type.upper() == "D":

                update_type = "Development"

                database_path = "G:\\Eurofighter programme Management\\1.PM Reporting\\Production Tracking Database\\dev_dms_tracker_data.mdb"

            elif run_type.upper() == "X":

                quit()
            print "%s Opening %s Database..." % (self.get_date_time(), update_type)

            conn=win32com.client.Dispatch('Access.Application' )

            try:

                conn.OpenCurrentDatabase(database_path)

            except:

                print "%s Assuming Database already open" % (self.get_date_time())
                pass

            print "%s Importing latest DMS Data..." % (self.get_date_time())

            datatype = conn.run("import_data")

Can anyone help with why this works running as a script in python but not when it has been compiled to an exe.

Thanks
Simon

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:54:46+00:00Added an answer on June 11, 2026 at 8:54 pm

    Following the advice from Juri Robi, I downloaded Pyinstaller and compiled the exe. This worked just fine with out any ajustments. I still dont know why py2exe did not work but for me Pyinstaller is a great new tool for me that I will be using again in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using this code, but have been running into some memory issues:
I'm exploring package building on Windows 7 but have been running into trouble after
I have been running this code (from: http://blog.somethingaboutcode.com/?p=155 ): from twisted.internet import reactor from
I have Python 3.2.2 downloaded and have been using IDLE to execute code; however,
I have been writing command-line Python scripts for a while, but recently I felt
A lot of questions have been asked and answered about running server-side javascript on
I am brand new to Python, and have been trying to get the Django
I've been thinking about what I would miss in porting some Python code to
I have been running around here and there on NoSQL big data storage technologies.
I have been running drush scripts (for Drupal ) with Cygwin on my relatively

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.