[Tutor] windows and python and shebangs, oh my!
Kirk Bailey
deliberatus at verizon.net
Fri Apr 6 15:53:04 CEST 2007
No problem, windoweswiki is shipped with a very simple server which is
pretty dullwitted, but handles cgi and http, and nothing else. a little
thing called tinyweb, it's efficent, small, and it is bulletproof- and
so stupid it's actually easy to use. You can read about it here:
http://www.ritlabs.com/tinyweb/
John Clark wrote:
> Be aware that by default the Apache web server _WILL_ use the shebang line
> even when running on Windows to try to find the Python interpreter when
> python is run as a CGI script.
>
> There is a setting in the configuration file that controls whether to use
> the shebang line or to reference the windows registry. The setting is
> ScriptInterpreterSource registry
>
> -jdc
>
> -----Original Message-----
> From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On Behalf
> Of Alan Gauld
> Sent: Thursday, April 05, 2007 4:28 AM
> To: tutor at python.org
> Subject: Re: [Tutor] windows and python and shebangs, oh my!
>
> "Kirk Bailey" <deliberatus at verizon.net> wrote
>
>> OK, in a script, we include a special statement telling the shell
>> where to go find the interpeter. This is the first line of the script,
>> and is a dpecial sort of comment, called informally the shebang.
>
> Yes, but it is not a Python feature it is a Unix thing.
> When you execute a script (of any kind) in Unix the Unix
> shell(*) reads the first line and if its a shebang transfers control to the
> appropriate interpreter.
>
> (*) And not all Unix shells adhere to the convention, but thankfully the
> vast majority do. The SVR4 Bourne shell didn't as I recall.
>
>> In windows, this is for the current edition C:\python25\pythonw.exe so
>> the shebang is #!C:\python\pythonw.exe
>
> This is often done purely as a convention that shows what version of Python
> the script was created for.
> Python does nothing with it, it is only a comment.
>
>> At a loss, it then occurred to me that the program is a .py name
>> extension. When the auto installer installed python it may have
>> created an association between that name extension and the correct
>> interpreter automatically,
>
> Correct, or you can do it manually. tHat is the only way that Windows
> associates files with commands.
>
>> So work with me, windows Pythonistas. CAN I rely on windows definitely
>> and reliably having .py files associated with the windows python
>> interpreter,
>
> No, the association can be changed by any user or install script.
>
> But in practice it rarely is changed so you can habe a good chance of
> success.
> If you really want to be sure the associations are stored in the registry.
> You can look them up and change them (or add a missing one) as you need.
>
>> If so, my task of designing the autoinstaller script just got a LOT
>> simpler.
>
> On Windows the answer is usually in the registry somewhere, you just need to
> figure out where to look!
>
> Alan G.
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
--
Salute!
-Kirk Bailey
Think
+-----+
| BOX |
+-----+
knihT
Fnord.
More information about the Tutor
mailing list