Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I do not know why but I cannot run a python script though the terminal.

my script:

define_regions.py

print "Hello World!"
print "Hello Again"
print "I like typing this."
print "This is fun."
print 'Yay! Printing.'
print "I'd much rather you 'not'."
print 'I "said" do not touch this.'

terminal:

pik:scripts katja$ python define_regions.py
pik:scripts katja$

It does not execute it somehow and I do not understand why.

Thank you in advance.

EDIT: run python

pik:scripts katja$ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

python -V
Python 2.7.6

pik:scripts katja$ which python
/usr/local/bin/python

EDIT2

pik:scripts katja$ python ./define_regions.py
pik:scripts katja$ python -c 'import sys; print sys.path'
['', '/usr/local/lib/python2.7/site-packages/setuptools-12.0.5-py2.7.egg', '/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']
pik:scripts katja$ python -c 'print "test"'
test
share|improve this question
    
What does python -V say? Does the REPL work, what does it do if you just run python on the commandline? What is the output of which python? –  onur güngör Mar 6 at 14:22
    
@onurgüngör I have edited my question with the information of yours –  Anni Mar 6 at 14:24
    
Now try python ./define_regions.py. Second, run python -c 'import sys; print sys.path', third try running python -c 'print "test"' –  onur güngör Mar 6 at 14:29
    
@onurgüngör edited it again, ./define_regions did not work –  Anni Mar 6 at 14:35
    
Interesting. Are you sure you got something in ./define_regions.py? Can you run cat ./define_regions.py? –  onur güngör Mar 6 at 14:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.