Note that there are some explanatory texts on larger screens.

plurals
  1. POAltering my python path: helloworld.py returns command not found—
    primarykey
    data
    text
    <p>Massive apologies for this embarrassing question—</p> <p>I'm using my MacBook Pro, running snow leopard, and using Python 2.7.1. Trying to run my first script and all the first pages of all my tutorials are laughing at me:</p> <p>Let me preface with: </p> <pre><code>$ whereis python /usr/bin/python $ which python /Library/Frameworks/Python.framework/Versions/2.7/bin/python </code></pre> <p>(Is this my issue?)</p> <p>I wrote helloworld.py to /users/charles in vim:</p> <pre><code>$ vim helloworld.py #!/usr/bin/python # Hello World Python Program print "Hello World!"; </code></pre> <p>When trying to run it from terminal:</p> <pre><code>$ helloworld.py -bash: helloworld.py: command not found </code></pre> <p>When trying to run it from python:</p> <pre><code>$ python &gt;&gt;&gt; helloworld.py Traceback (most recent call last): File :&lt;stdin&gt;", line 1, in &lt;module&gt; NameError: name 'helloworld' is not defined </code></pre> <p>From Dive Into Python (not sure if this is pertinent):</p> <pre><code>$ python &gt;&gt;&gt; import sys,os &gt;&gt;&gt; print 'sys.argv[0] =',sys.argv[0] sys.argv[0]= &gt;&gt;&gt; pathname=os.path.dirname(sys.argv[0]) &gt;&gt;&gt; print 'path=',pathname path= &gt;&gt;&gt; print 'full path=',os.path.abspath(pathname) full path= /Users/charles </code></pre> <p>I'm befuddled! Do I need to alter one of my paths so it finds my script? </p> <p>I'm absolutely new to programming, I actually just found out that terminal was something you could use.</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload