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 4603704
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:11:25+00:00 2026-05-22T00:11:25+00:00

I have a legacy python program which defined a module whose name conflict with

  • 0

I have a legacy python program which defined a module whose name conflict with a system module in the current python, what’s the easiest method to fix this? This module has been imported in many place, so it would be great if no need to change the the old python source.

  • 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-05-22T00:11:26+00:00Added an answer on May 22, 2026 at 12:11 am

    You could create a custom import routine using the imp module. For example, here I’m importing a module named string which shadows the real string module:

    import imp
    
    def user_import(name, path):
        mod_file, mod_path, mod_desc = imp.find_module(name, [path])
        return imp.load_module(name, mod_file, mod_path, mod_desc)
    
    # load the real 'string' module
    import string
    print string.digits
    
    # load the user 'string' module which lives under the path './foo'
    mod = user_import('string', './foo')
    print mod.digits
    

    Output:

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

Sidebar

Related Questions

I have a legacy VB6 program which installs an Access file in a sub-directory
I have some legacy code with a method foo which has 700+ overloads: [DllImport(3rdparty.dll)]
I have legacy code with properties defined as : private string name; public string
I have a legacy C++ module that offers encryption/decryption using the openssl library (DES
We have some legacy code that needs to identify in the Page_Load which event
I have a legacy WinForms Mdi App in VB.Net 2.0 which I am adding
I have the 'luck' of develop and enhance a legacy python web application for
I have a legacy ASP.NET application in which there are some session/concurrency related issues
We have a legacy database which is a sql server db (2005, and 2008).
We have legacy applications which soon they will start to use common jsp pages.

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.