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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:09:00+00:00 2026-06-15T10:09:00+00:00

Short of it – I need to get a console_script to return to me

  • 0

Short of it – I need to get a console_script to return to me its current run path, so that I can override modules it is using at run time.

Here is my basic setup (summarized as best I could):

    package_1:
      caller_module.py

    console_script_module:
      main.py
      dir_of_modules_to_use/
        a.py
        b.py
        c.py
      setup.py

    setup.py contents:
      setup(
        entry_points = {
          'console_scripts': [
            'console-script-module = console_script_module.main:main'
           ]
         }
        )         

Longer detail:
So caller_module.py calls console-script-module by issuing a subprocess call. In turn the modules seen in dir_of_modules_to_use are run. I would like to provide my own version of those modules by overriding them right before this happens through a separate script. In order to do this I need to know the run path of where console-script-module has been installed as it is not consistent (changes in virtualenv’s for example).

I tried adding this in to main.py and using a separate command line argument to call it:

    def print_absoulute_dir():    
      print os.path.abspath('dir_of_modules_to_use')

Unfortunately this only returns the path of wherever I make the call to the console script.

DISCLAIMER – this is hacky and awful I know, it’s from code I inherited and I just need something working in the short term. I unfortunately cannot change the code within caller_module.py at this time, otherwise I would just change how it is calling console_script_module:main.py.

  • 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-15T10:09:01+00:00Added an answer on June 15, 2026 at 10:09 am

    I’m not sure if i really understand what you want, but every python module has the __file__
    attribute, which contains its location in the filesystem,
    and you can use sys.path to modify python module search path

    import urllib
    import sys
    
    print urllib.__file__
    print sys.path
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short version: How can I get a regex that matches a@a.aaaa but not a@a.aaaaa
Short: Is there a way we can push to multiple remotes simultaneously using Github
Short version: How can I get the URL of the server my MVC3 project
Short version: For a cache class I need to get notified if an object
Short version: How do I get HttpServletRequest.getRemoteUser() to return the username when I am
short description I'm using jquery, jqueryUI and ajax. I use val() to get value
Short version : I think I need help with properly using events in PowerShell
Short: I need a right-click event to highlight the cell row. I am using
Short one: Am I correct in assuming, that the Samsung Galaxy S wifi 4.0
Short version: Can I grant access to external databases to a role? Long version:

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.