Strange syntax error, occurs only when script is executed directly

Chris Angelico rosuav at gmail.com
Tue Apr 22 08:52:28 EDT 2014


On Tue, Apr 22, 2014 at 10:36 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
>> These are the 15 first lines of the script:
>>
>> #! /opt/local/bin/python
>
> This being Solaris, what happens if you remove the space between the hash-
> bang and the path? On Linux it makes no difference, but Solaris tends to
> be a bit more idiosyncratic about things like this.

I'm pretty sure the POSIX standard stipulates that a space there is
optional. Should be no difference between "#!/" and "#! /" on any
compliant OS. (But I can't right now find a citation for that, so I
may be wrong.)

ChrisA



More information about the Python-list mailing list