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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:59:01+00:00 2026-05-16T01:59:01+00:00

I have an executable file, named, for example, resource.py . It is disposed in

  • 0

I have an executable file, named, for example, resource.py. It is disposed in the folder named resource. Renaming file or folder is objectionable – it is old product and users accustomed to use such naming. At old version it was under another project, so imports to it sound like import main_product.resource.<..>.

Now I need to use imports like import resource.<..> and __import__('resource.<..>', ...). Then I try it, I get an expected error, because Python try to import from the file resource.py first.

Suggestion solutions:

  1. remove path of current folder from sys.path:
    • we need an ugly chunk of code at the begin of the file;
    • no relative imports will be available in this folder;
  2. put folder path at the end sys.path list:
    • bigger chunk of ugly code at the begin of the file;
    • i am not sure that this feature will always work perfect.

Have any usable idea about this?

P.S. Python v2.6, FreeBSD 7.3

  • 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-16T01:59:02+00:00Added an answer on May 16, 2026 at 1:59 am

    Use imp.find_module() and imp.load_module()

    find_module lets you specify your own path to search

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

Sidebar

Related Questions

I have a executable jar file and i want to see code behind it.
I have running process but it's executable file has got deleted. If I try
I have created a directory structure with an executable file. Following is the output
I have a Mojolicious Lite script that gives out an executable file (user can
I have to generate an executable (.exe) file from my python program. I would
I have the problem running executable .jar file. I've created a project which contains
I have an executable jar Client.jar that requires jndi.properties file. Since the jndi properties
I have been trying to reverse a Mach-O executable arm file and I'm able
Let's assume I have a package which calls an executable file somewhere in the
I have a CMakeLists.txt file that looks like this: add_executable(exec1 exec1.c source1.c source2.c source3.c)

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.