LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-23-2012, 02:09 PM   #1
joham34
Member
 
Registered: Oct 2009
Location: Greece
Distribution: ubuntu 18.04
Posts: 89

Rep: Reputation: 4
shell wont open python scripts


Hello everybody
After hard reading, full of enthusiasm I decided to write my first python script. So I coded :
Code:
#!/usr/bin/Python
print "hello world"
I named this complicated script "mypython.py", chmoded it 777 and went to run it but alas! What i got was :
Code:
bash: /home/ioannis/bin/mypython.py: /bin/python: bad interpreter: No such file or directory
Code:
which python
returned :
Code:
/usr/bin/python
After googling I tried to change the shebang to
Code:
#! /usr/bin/env python
with exactly the same response. I tried with no empty spaces in various combinations, an /n at the end of the line, change "python" to "Python 2.7.3" which is the version installed, still no luck
I have ubuntu 12.04, fresh install , no upgrade
Any ideas that could help me continue my march to the tops of python ??
Thanks in advance

Last edited by joham34; 06-23-2012 at 03:26 PM.
 
Old 06-23-2012, 09:16 PM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
try a lowecase p in your shebang
 
Old 06-24-2012, 02:55 AM   #3
joham34
Member
 
Registered: Oct 2009
Location: Greece
Distribution: ubuntu 18.04
Posts: 89

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by graemef View Post
try a lowecase p in your shebang
Thanks ! it solved the problem. I had thought of upper and lowercase myself but somehow didnt try it apparently
May be, instead of coding, I should better try watching tv serials, I would be better to this :-)
 
Old 06-24-2012, 03:08 AM   #4
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Remember that Linux is case-sensitive and very rarely commands start with capital letters.

another method would be:

Code:
#!/usr/bin/env python

Last edited by sycamorex; 06-24-2012 at 08:24 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to close open ports using a python script or a shell script in python ?? apanimesh061 Programming 3 11-20-2011 12:31 AM
How to run shell scripts wrapped in Python. narnie Programming 20 07-15-2010 12:41 AM
Python: bash-shell-like less functionality in the python shell narnie Programming 4 06-29-2010 12:25 PM
Connection refused, cannot open python shell!? raskol Programming 0 03-30-2008 01:30 PM
python: can you update the current shell from python? BrianK Programming 4 01-31-2008 12:18 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration