473,382 Members | 1,107 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Python scripts in IIS

I'm having trouble executing Python scripts in IIS. I have the error message
"%1 is not a valid Win32 application". Anyone know what this is about?

Jon Cosby
Jul 18 '05 #1
13 3184
Jon Cosby wrote:

I'm having trouble executing Python scripts in IIS. I have the error message
"%1 is not a valid Win32 application". Anyone know what this is about?


Somewhere, something is attempting to execute an application with an
argument that contains "%1", which is normally substituted with a
variable string supplied by something else. Clearly that isn't happening
here.

Without more detail, I doubt anyone can help much more. Maybe you should
post some snippets of code. Also, if the error message actually includes
more information (e.g. such as a Python traceback would have), cut and paste
the entire output rather than just retyping a part of it (if that's what you
did).

-Peter
Jul 18 '05 #2
"Peter Hansen" <pe***@engcorp.com> wrote
I'm having trouble executing Python scripts in IIS. I have the error message "%1 is not a valid Win32 application". Anyone know what this is about?
Somewhere, something is attempting to execute an application with an
argument that contains "%1", which is normally substituted with a
variable string supplied by something else. Clearly that isn't happening
here.

Without more detail, I doubt anyone can help much more. Maybe you should
post some snippets of code. Also, if the error message actually includes
more information (e.g. such as a Python traceback would have), cut and

paste the entire output rather than just retyping a part of it (if that's what you did).

-Peter


I get the same line with all of my scripts, nothing else.

Jon
Jul 18 '05 #3
Jon Cosby wrote:

"Peter Hansen" <pe***@engcorp.com> wrote
Without more detail, I doubt anyone can help much more.


I get the same line with all of my scripts, nothing else.


Please go back and reread the previous sentence again. If you won't
provide some context, you won't likely get helpful answers.

I'll try again: *what* is giving you that error message? Some program
prints it, somewhere. Is it in a log file? Printed to the console?
In a popup dialog box? On the browser screen? What exact command did you
type just before you saw that error. Have you installed Python?
What version? etc etc etc...

-Peter
Jul 18 '05 #4
"Peter Hansen" <pe***@engcorp.com> wrote
Jon Cosby wrote:

"Peter Hansen" <pe***@engcorp.com> wrote
Without more detail, I doubt anyone can help much more.


I get the same line with all of my scripts, nothing else.


Please go back and reread the previous sentence again. If you won't
provide some context, you won't likely get helpful answers.

I'll try again: *what* is giving you that error message? Some program
prints it, somewhere. Is it in a log file? Printed to the console?
In a popup dialog box? On the browser screen? What exact command did you
type just before you saw that error. Have you installed Python?
What version? etc etc etc...


Sorry. It's in the browser window. The script does not execute. I have "Show
friendly http error messages" set to false in Internet Explorer. As it
happens on all of the scripts, I can't single out one command. I have
ActiveState's build of Python 2.3, and don't recall running into this
previously, but there might be something in the IIS configuration I'm
overlooking.

Jon
Jul 18 '05 #5
"Jon Cosby" <jc****@nospam.net> wrote in
news:aH*****************@newsread1.news.pas.earthl ink.net:

Sorry. It's in the browser window. The script does not execute. I
have "Show friendly http error messages" set to false in Internet
Explorer. As it happens on all of the scripts, I can't single out
one command. I have ActiveState's build of Python 2.3, and don't
recall running into this previously, but there might be something
in the IIS configuration I'm overlooking.


Go to the Properties of the (Default) Web site, Home Directory tab,
Configuration button. On the Mappings tab, add a mapping for Python in
the form

<pathtopython>\python.exe %s %s

Use your actual pathtopython and don't substitute anything for %s %s.

Should work fine.

Scott
Jul 18 '05 #6

"Scott F" <sdfATexpertuneDOTcom> wrote

Sorry. It's in the browser window. The script does not execute. I
have "Show friendly http error messages" set to false in Internet
Explorer. As it happens on all of the scripts, I can't single out
one command. I have ActiveState's build of Python 2.3, and don't
recall running into this previously, but there might be something
in the IIS configuration I'm overlooking.


Go to the Properties of the (Default) Web site, Home Directory tab,
Configuration button. On the Mappings tab, add a mapping for Python in
the form

<pathtopython>\python.exe %s %s

Use your actual pathtopython and don't substitute anything for %s %s.

Should work fine.

Thanks. I had left out the trailing arguments. What is "%s" for, anyway?

Jon
Jul 18 '05 #7
"Jon Cosby" <jc****@nospam.net> wrote in
news:6D*****************@newsread1.news.pas.earthl ink.net:
Thanks. I had left out the trailing arguments. What is "%s" for,
anyway?


I don't know. With MS I usually don't bother finding out if I can get
things to work.

Scott
Jul 18 '05 #8

Jon Cosby wrote:
"Scott F" <sdfATexpertuneDOTcom> wrote

Sorry. It's in the browser window. The script does not execute. I
have "Show friendly http error messages" set to false in Internet
Explorer. As it happens on all of the scripts, I can't single out
one command. I have ActiveState's build of Python 2.3, and don't
recall running into this previously, but there might be something
in the IIS configuration I'm overlooking.

Go to the Properties of the (Default) Web site, Home Directory tab,
Configuration button. On the Mappings tab, add a mapping for Python in
the form

<pathtopython>\python.exe %s %s

Use your actual pathtopython and don't substitute anything for %s %s.

Should work fine.

Thanks. I had left out the trailing arguments. What is "%s" for, anyway?

Jon

Sorry, I just read this message. I did not the beginning of this thread.
Jon, why don't you register
Python as an ActiveX scripting language? You can download and install
pywin32 extensions:

https://sourceforge.net/projects/pywin32/

then you can run this script:

site-packages\win32comext\axscript\client\pyscript.py

This will register Python as an ActiveX scripting language.
Then you can create an ASP page like this (index.asp):

<%@ Language=Python %>
<%
lst = [0,1,2,3]
Response.write(str(lst))
%>

I think it is better (and faster) to use Python as an ActiveX scripting
language then to use it as a CGI program.
Best,

G
Jul 18 '05 #9
Jon Cosby <jc****@nospam.net> wrote:
Thanks. I had left out the trailing arguments. What is "%s" for, anyway?


It gets substituted with the name of the .py file.

Note: you really want -

...python.exe -u %s %s

The -u ensures you get binary IO streams, which will become significant if
you are receiving file upload fields or returning a non-textual response
(ie. file download).

--
Andrew Clover
mailto:an*@doxdesk.com
http://www.doxdesk.com/
Jul 18 '05 #10
an********@doxdesk.com (Andrew Clover) wrote in
news:2c**************************@posting.google.c om:

Note: you really want -

...python.exe -u %s %s

The -u ensures you get binary IO streams, which will become
significant if you are receiving file upload fields or returning a
non-textual response (ie. file download).


Can you reference the documentation for the -u argument?

Thanks.

Scott
Jul 18 '05 #11
Scott F wrote:

an********@doxdesk.com (Andrew Clover) wrote in
news:2c**************************@posting.google.c om:

Note: you really want -

...python.exe -u %s %s

The -u ensures you get binary IO streams, which will become
significant if you are receiving file upload fields or returning a
non-textual response (ie. file download).


Can you reference the documentation for the -u argument?


"python -h" will show you.
Jul 18 '05 #12
Peter Hansen <pe***@engcorp.com> wrote in news:403CCF0C.693FBAE2
@engcorp.com:
Can you reference the documentation for the -u argument?


"python -h" will show you.


Right for python, but not for IIS. E.g., in

<path>python.exe %s %s

The first %s stands for the script name, and the second %s stands for
_all_ the arguments. This is not normal substitution. That's why %s
needs to be used, not even %S (capitalized).

Actually, Robert Brewer's response is more to the point. Security is
more troublesome with the above.

Jul 18 '05 #13
Scott F wrote:

Peter Hansen <pe***@engcorp.com> wrote in news:403CCF0C.693FBAE2
@engcorp.com:
Can you reference the documentation for the -u argument?


"python -h" will show you.


Right for python, but not for IIS.


Wasn't the -u used as an option to Python in the example you were
asking about?

Andy had written this (re-posted here for reference):
Note: you really want -

...python.exe -u %s %s


Looks like a Python option to me, not an IIS one...

-Peter
Jul 18 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Shufen | last post by:
Hi, Can someone please advice me on the differences between this: #!/usr/bin/env python and these: #!/usr/local/bin/python or #!/usr/bin/python? I know the first one locates the Python...
8
by: Jan Danielsson | last post by:
Hello all, How do I make a python script actually a _python_ in unix:ish environments? I know about adding: #!/bin/sh ..as the first row in a shell script, but when I installed python on...
0
by: marco | last post by:
hi folks, i can not run any python scripts with dos lineendings under cygwin's python. if i run such a scripts i get stupid syntax error messages from python. what can i do to run these...
20
by: Ramdas | last post by:
How do I add users using Python scripts on a Linux machine? Someone has a script?
6
by: Ishpeck | last post by:
I'm using Python to automate testing software for my company. I wanted the computers in my testing lab to automatically fetch the latest version of the python scripts from a CVS repository and...
24
by: Mark | last post by:
Hi, I'm new to python and looking for a better idiom to use for the manner I have been organising my python scripts. I've googled all over the place about this but found absolutely nothing. I'm...
0
by: ashish | last post by:
Hi All, I need one help ,i started learning python few months back and i am comfortable with python now ,My intrest is, i want to genrate python scripts from GUI i.e. My GUI should be having...
2
by: joe jacob | last post by:
I need to configure apache to run python scripts. I followed the steps mentioned in this site (http://www.thesitewizard.com/archive/ addcgitoapache.shtml). But I am not able to run python scripts...
3
by: joe jacob | last post by:
I configured apache to execute python scripts using mod_python handler. I followed below mentioned steps to configure apache. 1. In http.conf I added <Directory...
2
by: Dale | last post by:
I am using a simple python webserver (see code below) to serve up python scripts located in my cgi-bin directory. import BaseHTTPServer import CGIHTTPServer class...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.