<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Run a Python script in Mac OS X Terminal</title>
	<atom:link href="http://beckism.com/2008/05/run_python_mac_os_x/feed/" rel="self" type="application/rss+xml" />
	<link>http://beckism.com/2008/05/run_python_mac_os_x/</link>
	<description>Fiction, opinions, and more</description>
	<lastBuildDate>Tue, 07 Sep 2010 12:53:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: juan</title>
		<link>http://beckism.com/2008/05/run_python_mac_os_x/comment-page-1/#comment-27778</link>
		<dc:creator>juan</dc:creator>
		<pubDate>Thu, 13 May 2010 22:21:34 +0000</pubDate>
		<guid isPermaLink="false">http://beckism.com/2008/05/run_python_mac_os_x/#comment-27778</guid>
		<description>Hi,
I would like to know if there is a way to avoid the python launcher once you execute the code in terminal.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I would like to know if there is a way to avoid the python launcher once you execute the code in terminal.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lord iglio</title>
		<link>http://beckism.com/2008/05/run_python_mac_os_x/comment-page-1/#comment-27692</link>
		<dc:creator>lord iglio</dc:creator>
		<pubDate>Sun, 25 Apr 2010 10:14:30 +0000</pubDate>
		<guid isPermaLink="false">http://beckism.com/2008/05/run_python_mac_os_x/#comment-27692</guid>
		<description>Thank you! Exactly what I was looking for.

Cheers!</description>
		<content:encoded><![CDATA[<p>Thank you! Exactly what I was looking for.</p>
<p>Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry Webber</title>
		<link>http://beckism.com/2008/05/run_python_mac_os_x/comment-page-1/#comment-16754</link>
		<dc:creator>Barry Webber</dc:creator>
		<pubDate>Mon, 01 Sep 2008 22:13:51 +0000</pubDate>
		<guid isPermaLink="false">http://beckism.com/2008/05/run_python_mac_os_x/#comment-16754</guid>
		<description>Somewhere I came across the suggestion that a non-ascii script can have a problem. If UTF-8, there can be a &#039;BOM&#039; marker at the front - invisible characters that get in front of the shebang #! and mess things up.

Barry</description>
		<content:encoded><![CDATA[<p>Somewhere I came across the suggestion that a non-ascii script can have a problem. If UTF-8, there can be a &#8216;BOM&#8217; marker at the front &#8211; invisible characters that get in front of the shebang #! and mess things up.</p>
<p>Barry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry Webber</title>
		<link>http://beckism.com/2008/05/run_python_mac_os_x/comment-page-1/#comment-16753</link>
		<dc:creator>Barry Webber</dc:creator>
		<pubDate>Mon, 01 Sep 2008 22:06:46 +0000</pubDate>
		<guid isPermaLink="false">http://beckism.com/2008/05/run_python_mac_os_x/#comment-16753</guid>
		<description>Todd, your first suggestion was spot on for me!

./scriptname.py solved my problem, thanks very much.

Not that I understand what is happening, because I can do ls -l at the prompt and see my script file, but entering that script filename at the prompt gets me &#039;command not found&#039;.

I guess more reading is called for when I get a new candle.

Barry</description>
		<content:encoded><![CDATA[<p>Todd, your first suggestion was spot on for me!</p>
<p>./scriptname.py solved my problem, thanks very much.</p>
<p>Not that I understand what is happening, because I can do ls -l at the prompt and see my script file, but entering that script filename at the prompt gets me &#8216;command not found&#8217;.</p>
<p>I guess more reading is called for when I get a new candle.</p>
<p>Barry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Beck</title>
		<link>http://beckism.com/2008/05/run_python_mac_os_x/comment-page-1/#comment-16521</link>
		<dc:creator>Ian Beck</dc:creator>
		<pubDate>Thu, 21 Aug 2008 14:58:02 +0000</pubDate>
		<guid isPermaLink="false">http://beckism.com/2008/05/run_python_mac_os_x/#comment-16521</guid>
		<description>Just a note for anyone trying to use Jonggun Lee&#039;s suggestion: you&#039;d better be using Windows to have it work.</description>
		<content:encoded><![CDATA[<p>Just a note for anyone trying to use Jonggun Lee&#8217;s suggestion: you&#8217;d better be using Windows to have it work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jonggunLee</title>
		<link>http://beckism.com/2008/05/run_python_mac_os_x/comment-page-1/#comment-16518</link>
		<dc:creator>jonggunLee</dc:creator>
		<pubDate>Thu, 21 Aug 2008 14:19:29 +0000</pubDate>
		<guid isPermaLink="false">http://beckism.com/2008/05/run_python_mac_os_x/#comment-16518</guid>
		<description>you can use the command which name is &#039;dos2unix&#039; and try again the python file. ^^</description>
		<content:encoded><![CDATA[<p>you can use the command which name is &#8216;dos2unix&#8217; and try again the python file. ^^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Beck</title>
		<link>http://beckism.com/2008/05/run_python_mac_os_x/comment-page-1/#comment-15435</link>
		<dc:creator>Ian Beck</dc:creator>
		<pubDate>Mon, 19 May 2008 14:07:24 +0000</pubDate>
		<guid isPermaLink="false">http://beckism.com/2008/05/run_python_mac_os_x/#comment-15435</guid>
		<description>Ha; a Python script to fix my Python script would definitely solve all of my problems.</description>
		<content:encoded><![CDATA[<p>Ha; a Python script to fix my Python script would definitely solve all of my problems.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd Ransom</title>
		<link>http://beckism.com/2008/05/run_python_mac_os_x/comment-page-1/#comment-15434</link>
		<dc:creator>Todd Ransom</dc:creator>
		<pubDate>Mon, 19 May 2008 11:06:22 +0000</pubDate>
		<guid isPermaLink="false">http://beckism.com/2008/05/run_python_mac_os_x/#comment-15434</guid>
		<description>ok, I have one last thought and then I will give up on my obsessive problem solving of this non-issue. I think your file has Mac line endings (\r) instead of Unix line endings (\n), which is confusing your shell.

If you have TextMate you can save with Unix line endings from the save as dialog. If you don&#039;t you just need to find some other way to replace the carriage returns with linefeeds. A simple python script maybe :D

Todd</description>
		<content:encoded><![CDATA[<p>ok, I have one last thought and then I will give up on my obsessive problem solving of this non-issue. I think your file has Mac line endings (\r) instead of Unix line endings (\n), which is confusing your shell.</p>
<p>If you have TextMate you can save with Unix line endings from the save as dialog. If you don&#8217;t you just need to find some other way to replace the carriage returns with linefeeds. A simple python script maybe :D</p>
<p>Todd</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Beck</title>
		<link>http://beckism.com/2008/05/run_python_mac_os_x/comment-page-1/#comment-15430</link>
		<dc:creator>Ian Beck</dc:creator>
		<pubDate>Mon, 19 May 2008 03:20:11 +0000</pubDate>
		<guid isPermaLink="false">http://beckism.com/2008/05/run_python_mac_os_x/#comment-15430</guid>
		<description>Amusingly enough, I had set chmod +x on the file before trying to run it (after setting the permissions in the Finder Get Info window to no effect).

I don&#039;t know what it was with this file, but it just demanded to be run with the python command.  :-)</description>
		<content:encoded><![CDATA[<p>Amusingly enough, I had set chmod +x on the file before trying to run it (after setting the permissions in the Finder Get Info window to no effect).</p>
<p>I don&#8217;t know what it was with this file, but it just demanded to be run with the python command.  :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd Ransom</title>
		<link>http://beckism.com/2008/05/run_python_mac_os_x/comment-page-1/#comment-15429</link>
		<dc:creator>Todd Ransom</dc:creator>
		<pubDate>Mon, 19 May 2008 02:48:29 +0000</pubDate>
		<guid isPermaLink="false">http://beckism.com/2008/05/run_python_mac_os_x/#comment-15429</guid>
		<description>ah, I bet your script does not have execute permissions on it. An ls -l will show you:

prometheus:bin kinch$ ls -l
...
-rwxr-xr-x@ 1 kinch  kinch    1286 Dec 22 10:42 ftp-backup.sh

the first entry is the permission on the file for owner, group, and everyone. You can use chmod +x on the file to add execute permissions.

Todd</description>
		<content:encoded><![CDATA[<p>ah, I bet your script does not have execute permissions on it. An ls -l will show you:</p>
<p>prometheus:bin kinch$ ls -l<br />
&#8230;<br />
-rwxr-xr-x@ 1 kinch  kinch    1286 Dec 22 10:42 ftp-backup.sh</p>
<p>the first entry is the permission on the file for owner, group, and everyone. You can use chmod +x on the file to add execute permissions.</p>
<p>Todd</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian Beck</title>
		<link>http://beckism.com/2008/05/run_python_mac_os_x/comment-page-1/#comment-15428</link>
		<dc:creator>Ian Beck</dc:creator>
		<pubDate>Mon, 19 May 2008 01:19:22 +0000</pubDate>
		<guid isPermaLink="false">http://beckism.com/2008/05/run_python_mac_os_x/#comment-15428</guid>
		<description>There actually was a line like that although it read &lt;span class=&quot;code&quot;&gt;#!/usr/bin/env python&lt;/span&gt;.  I tried dropping the &quot;env&quot; and making it &lt;span class=&quot;code&quot;&gt;/usr/bin/python&lt;/span&gt; (since I&#039;d peeked into the /urs/bin folder and seen what looked like a Python executable), but the script still failed.  I&#039;m not entirely sure why.  Running it with the &lt;span class=&quot;code&quot;&gt;python&lt;/span&gt; command was the only way I could get it to work.

It might be that I need to configure the $path variable for my bash shell (it looked like it only included /usr/local/bin), but the syntax in the ~/.login file was confusing enough that I figured it would be safer not to mess with it (particularly since I had gotten the script to work).</description>
		<content:encoded><![CDATA[<p>There actually was a line like that although it read <span class="code">#!/usr/bin/env python</span>.  I tried dropping the &#8220;env&#8221; and making it <span class="code">/usr/bin/python</span> (since I&#8217;d peeked into the /urs/bin folder and seen what looked like a Python executable), but the script still failed.  I&#8217;m not entirely sure why.  Running it with the <span class="code">python</span> command was the only way I could get it to work.</p>
<p>It might be that I need to configure the $path variable for my bash shell (it looked like it only included /usr/local/bin), but the syntax in the ~/.login file was confusing enough that I figured it would be safer not to mess with it (particularly since I had gotten the script to work).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd Ransom</title>
		<link>http://beckism.com/2008/05/run_python_mac_os_x/comment-page-1/#comment-15427</link>
		<dc:creator>Todd Ransom</dc:creator>
		<pubDate>Mon, 19 May 2008 00:54:28 +0000</pubDate>
		<guid isPermaLink="false">http://beckism.com/2008/05/run_python_mac_os_x/#comment-15427</guid>
		<description>You should be able to add a shebang line to the top of your script to avoid this:

#!/usr/bin/python

Also, don&#039;t forget that on Unix systems the current directory is not usually in the path (on DOS-based systems it is always in the path). So if you are in a directory and want to run a script you have to do it like this:

./somescript.py

;)

Todd</description>
		<content:encoded><![CDATA[<p>You should be able to add a shebang line to the top of your script to avoid this:</p>
<p>#!/usr/bin/python</p>
<p>Also, don&#8217;t forget that on Unix systems the current directory is not usually in the path (on DOS-based systems it is always in the path). So if you are in a directory and want to run a script you have to do it like this:</p>
<p>./somescript.py</p>
<p>;)</p>
<p>Todd</p>
]]></content:encoded>
	</item>
</channel>
</rss>
