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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:22:38+00:00 2026-06-06T08:22:38+00:00

I have been putting my code on github, but I’ve run into an implementation

  • 0

I have been putting my code on github, but I’ve run into an implementation snag. I run the same code on many computers (including a computer that I do not have root access on).

One piece of code (a bash script) calls some python code like:

python somecode.py

The shell will run the correct version of python, but it won’t find somecode.py.

What I’ve tried:

Fail #1: I tried to add both the directory which contains somecode.py and the full path to the file to the PATH; to no avail. [Errno 2] No such file or directory

Fail #2: I can make it work for one computer ONLY if I add the full path to the correct version of python in the top line:

#!/usr/local/cool/python/version/location

However this breaks it running on any other computer.

Fail #3: I can also make it work if I make the bash script say:

python /full/path/to/github/place/somecode.py

but again, this only works for ONE computer because the paths are different for different computers.

What I really want to do: I want to be able to use the same code (both bash script and somecode.py) on multiple computers.

Any suggestions about how to do this properly is welcome. Thanks!

Solution

Added:

#!/usr/bin/env python

To the top of my somecode.py code;

mv somecode.py somecode
chmod +x somecode

Make sure PATH has /full/path/to/directory/with/somecode.

Bash script now says only:

somecode

and it works.

  • 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-06T08:22:40+00:00Added an answer on June 6, 2026 at 8:22 am

    For problem #2 try

    #!/usr/bin/env python
    

    though it may find different versions of Python on different machines, but as long as that’s not a problem this should fix that particular problem

    See this SO question Python deployment and /usr/bin/env portability too. And this post by Alex Martelli re use of this.

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

Sidebar

Related Questions

I'm new to AS3 and have been putting my code on the timeline and
I have been reading some WordPress PHP code on GitHub and I found that
I have been working on this script for a long time, but the code
I have been putting off developing this part of my app for sometime purely
ListViews have always been my weak point and right now I am practicing putting
Have been looking on some tutorials for drawing canvas using SurfaceView, but the only
Have been searching how to convert a dictionary to a string. But the results
I have been putting off activity on SO because my current reputation is 1337.
I am to c# and have been putting programs together through modification of existing
A lot of questions have been asked about gem support in Shoes, but none

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.