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

  • Home
  • SEARCH
  • 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 7784107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:02:29+00:00 2026-06-01T20:02:29+00:00

At my work there is a Python 2.5 application in use that was compiled

  • 0

At my work there is a Python 2.5 application in use that was compiled with py2exe and then distributed to users. Due to migration to a new database, I have been tasked with updating the application. Unfortunately, we no longer have the original source code. (Although we do have the source of other projects that were derived from that code base.)

Fortunately, I do have access to the compiled .pyc files that are located in library.zip. Having located the .pyc file, I imported it, perused its documentation, and tested its behavior. Combined with the fact that I have a later version of the source code I believe I have a good handle on what’s in the .pyc file.

So now I have removed the old .pyc file from library.zip and added back in my new version. And it mostly works.

If provided with correct input, the old program successfully calls the new code in library.zip and behaves just how it used to. However, the old code will not catch any of the new code’s exceptions. I have opened both modules in the interpreter and compared the exceptions and they seem identical (same class name, even same error strings).

So my question is, where do I go from here? My suspicion is that even though I cannot see any difference between the exceptions, something about them must be different. How do I further test this? What else might I be missing?

  • 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-01T20:02:30+00:00Added an answer on June 1, 2026 at 8:02 pm

    The old and new exceptions have the same name, but they seem to be distinct objects living in different modules. At least, under that scenario you’ll get exactly the behavior you describe. Solution: Try importing the exceptions from each of the remaining .pyc files. When you find them, import them into your replacement code and raise those instead of your replacements.

    Demonstration of the problem: The function call raises module2.myException, but the caller expects module1.myException. I can’t say for sure that this is your problem, but if it’s not, it ought to be 🙂

    ---- module1.pyc ---  (Old: no source code)
    class myException(Exception):
        pass    
    
    ---- module2.py --- (New: Your replacement for the old module2.py)
    class myException(Exception):
        pass
    
    def myfunction():
        raise myException()
    
    ---- mainmodule.pyc ---  (Old: no source code)
    from oldmodule1 import myException
    
    import module2
    try:
        module2.myfunction()
    except myException:
        print "Caught it!"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any guidelines to writing Google App Engine Python code that would work
Is there anyway to get tuple operations in Python to work like this: >>>
Does BeautifulSoup work with Python 3? If not, how soon will there be a
In an OLAP database I work with there is a 'Location' hierarchy consisting of
In an OLAP database I work with there is a 'Location' hierarchy consisting of
I was thinking that the SQLDataReader should not work if there is no connection
I'm developing a python application and have a question regarding coding it so that
I am developing a library and an application that uses the library in Python
I am building an application that will need to use a mapping service to
I have an application that uses Flash for the GUI and Python for the

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.