开发者

Erratic behaviour of Python CGI-script on IIS7

开发者 https://www.devze.com 2023-03-07 14:16 出处:网络
I am debugging a CGI script written in Python which executes on IIS. The script fails to generate a response 3 out of 4 times. Along with some standard modules I also import boto and a custom module &

I am debugging a CGI script written in Python which executes on IIS. The script fails to generate a response 3 out of 4 times. Along with some standard modules I also import boto and a custom module <my_module>.

For debugging purposes I commented out all the code except for module imports and the mandatory header response:

print('Status: 200 OK')
print('Content-type: text/html')
print('')

import <standard modules>
import boto
import <my_module>

# Commented out code below
# <code>

This way I found out that merely importing <my_module> drops the success rate from 100% to the aforementioned ~25%. Why could that be? What can I test to improve the situation?

The script works flawlessly on a local Apache. <my_module> is by far smaller than boto.

Thank you,

/David

Edit: Ok, so I don't want to rush to conclusions here, but it looks like the 3rd party module pyodbc which is used within <my_module> has something to d开发者_运维问答o with the issue. If I place said 3rd party module at the top of my import list in the main script things seem to work better.

0

精彩评论

暂无评论...
验证码 换一张
取 消