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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:21:32+00:00 2026-06-09T12:21:32+00:00

i created an executable egg to make it as an single file executable. setup.py

  • 0

i created an executable egg to make it as an single file executable.

setup.py:

#!/usr/bin/env python
from setuptools import setup, find_packages

setup(
    name='app',
    version='0.5',
    description='foo',
    author='microo8',
    author_email='xxx@email.com',
    packages=["foo", "bar"],
    install_requires=["sqlalchemy>=0.7", "paramiko>=1.7.7.1"],
    entry_points = {
        'setuptools.installation': [
            'eggsecutable = foo.module:main',
        ]
    }
)

I can now call it: ./app-0.5-py2.7.egg, but the relative paths are all in the egg.
when I call print __file__ in the main function it prints /home/user/app-0.5-py2.7.egg/foo/module.py. I want to read an config file that must be in the same dir as the egg. And the same script must be executable also as “non-egg”, so the config file will be in the dir with the script.

how can i find out that the script is executed from an egg and also the egg path?

  • 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-09T12:21:34+00:00Added an answer on June 9, 2026 at 12:21 pm

    So I dont know how to check that the running script is in an egg, but the config file path can be obtained with this: os.path.realpath('config.cfg').

    This suits me and when I have a dir with the executable egg and an config file this is a correct path.

    Also when I have just the script in the dir with the config file it also is correct.

    And also when i use pyinstaller to create an singlefile exe.

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

Sidebar

Related Questions

I have a c# executable file (created from a windows form application) and I
I'm still new to Python and py2exe. I've created an executable from py2exe, but
I created an executable jar and executed it using process builder from another java
I have created a directory structure with an executable file. Following is the output
I have the problem running executable .jar file. I've created a project which contains
I'm using Ubuntu 10.04 and Qt4.6, and I've created an executable binary file on
Is it possible to make 3rd party external executable to use instance of python
i have created executable jar file of my project built in eclipse. but when
I've created a executable jar file in an Windows environment. I'm able to run
I created an executable jar file with eclipse indigo, but when i double click

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.