473,666 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3200
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******** *********@newsr ead1.news.pas.e arthlink.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" <sdfATexpertune DOTcom> 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******** *********@newsr ead1.news.pas.e arthlink.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" <sdfATexpertune DOTcom> 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,
Configurati on 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\win32c omext\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*@doxd esk.com
http://www.doxdesk.com/
Jul 18 '05 #10

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

Similar topics

2
1953
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 interpreter according to my system searching path setting. But I read about an article that mentioned that if we are running the scripts as a CGI from a Web server then we should use the latter one. Because I'm using python
8
2021
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 a NetBSD system, I didn't get a "python" executable; only a "python2.4"
0
1193
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 scripts without changing the lineending of these scripts. regards marco -----BEGIN PGP SIGNATURE-----
20
18867
by: Ramdas | last post by:
How do I add users using Python scripts on a Linux machine? Someone has a script?
6
3940
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 then ask a local database server which of the scripts to run. I built the following: #!/bin/bash # Batcher will run the specified scripts.
24
2832
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 a linux/unix command line guy quite experienced in shell scripts etc. I have a heap of command line utility scripts which I run directly. What is the best way to create python command line scripts but exploit the (loadonly) speed-up benefit of...
0
857
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 macros or function of my intrest ,so if i select them it should generate corressponding python script for that.Can any one tell from where i will get such API or GUI application which will generate python scripts. Regards
2
3105
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 from Firefox, I got a forbidden error "you do not have permission to access the file in the server" when I try to run the script form Firefox browser. Somebody please help me.
3
4932
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 "D:/softwares/Apache2.2/htdocs"> AddHandler mod_python .py PythonHandler mptest PythonDebug On </Directory>
2
2068
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 Handler(CGIHTTPServer.CGIHTTPRequestHandler): cgi_directories = httpd = BaseHTTPServer.HTTPServer(('',8000), Handler) httpd.serve_forever()
0
8454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8362
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8878
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8560
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8644
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7389
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.