English 中文(简体)
你如何在沙捞越的网页上展示 st?
原标题:How do you display stdout on a web page generated by Python?

我正在撰写一份网络应用程序,将在当地Windows服务器上安装一个指挥系统,并显示产出。 我的法典中的“Popen()”呼吁对“Good”译员执行罚款,但通过国际独立调查局执行时会留下新的错误。 !

案文:

追溯(最近发出的呼吁):

File "C:pythonappsmystdout.py", line 9, in print Popen( ipconfig , shell=True, stdout=PIPE).communicate()[0]

File "C:Python27libsubprocess.py", line 672, in init errread, errwrite) = self._get_handles(stdin, stdout, stderr)

File "C:Python27libsubprocess.py", line 774, in _get_handles p2cread = _subprocess.GetStdHandle(_subprocess.STD_INPUT_HANDLE)

WindowsError: [Error 6] 工作无效

from subprocess import *

print "Content-type:text/html

"
print "<html>"
print "<head>"
print "<title>FSPCT app</title>"
print "</head>"
print "<body>"
print Popen( ipconfig , shell=True, stdout=PIPE).communicate()[0]
print "</body>"
print "</html>"
最佳回答

它像国际电子数据系统服务器那样,拥有有效的中层文档处理(并非所有如此令人惊讶的,因为它是一个服务器过程)。 www.un.org/Depts/DGACM/index_french.htm 模块正试图复制该档文件......和失败。

为了确定这一点,请打电话P open,用于跟踪处理程序,然后将处理文件交给国家排雷中心处理(并可能过于仓促)。 (os.nudevll is the portable way of refer to that file in 2.7.) Said NUL案(或“Unix”下/dev/null)简单地抛弃了提交给它的所有材料,并在阅读时立即归还档案。 完善。

修改你的法典如下:

import os
...
with open(os.devnull,  r+ ) as nul:
    print Popen( ipconfig , shell=True, stdin=nul, stdout=PIPE, stderr=nul).communicate()[0]

(在即将到来的A/63/13.3中,你现在可以通过分处理。) DEVNUL与Popen的 st、 st或 arguments笑论,以便更简明地做同样的事。

问题回答

subprocess.P open( 等级数值为None,从母体过程起步。

为使用内部部分,仅通过<条码>stdin=PIPE,请上<条码>。

print Popen( ipconfig , shell=True, stdin=PIPE, stdout=PIPE).communicate()[0]




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签