试图从WSGI / Python的(诚然,快速和肮脏的)胜利Chrome启动。 XP,X86的Python 2.7,Apache 2.2的] [英] Trying to start Chrome from WSGI/Python (admittedly quick-and-dirty) [Win. XP, x86, Python 2.7, Apache 2.2]
问题描述
所以通常我太固执使用论坛网站自己的(叫我自豪),但是这已经快把我气死绝对
So typically I am too stubborn to use forum sites myself (call me proud), but this has been driving me absolutely mad.
我的目标很简单的在服务器计算机上启动浏览器,通过该服务器的蟒蛇WSGI脚本。我知道,prevents Python从下WSGI用popen错误的,但我已经想通似乎什么的 的像一个可行的(虽然有点劈-Y)的解决方案了:而不是调用POPEN与实际的命令,我创建了一个.BAT,并呼吁通过POPEN与壳参数设置为真
蝙蝠。这实际上适用于几乎所有的除了我需要它;也就是说,调用启动IEXPLORE
工作启动Firefox
工作,甚至记事本
和 MSPAINT
,但只是没有工作的事情,在呼唤启动铬
。我甚至尝试了一些命令行参数,如启动铬--single进程
,但没有avial。
My goal is simply to start Chrome on a server machine, through that server's python WSGI script. I am aware of the bug that prevents Python from using Popen under WSGI, but I've figured out what seemed like a workable (albeit somewhat hack-y) solution: instead of calling Popen with the actual command, I created a .bat and called the bat through Popen with the shell argument set to True
. This actually works for just about everything other than what I needed it to; i.e., calling start iexplore
worked, start firefox
worked, even notepad
and mspaint
, but the only thing that didn't work, was calling start chrome
. I've even tried a few command-line arguments, like start chrome --single-process
, but to no avial.
这就像Windows只是讨厌的Chrome。我将不胜AP preciate任何帮助,因为我已经出来拉我的头发在这个过去48小时。
It's like Windows just hates Chrome. I would greatly appreciate any help, as I've been pulling my hair out over this for the last 48 hours.
TL;博士:Chrome浏览器不会使用 subprocess.Popen
称为批处理脚本,但一切将开始
tl;dr: Chrome won't start from a batch script called using subprocess.Popen
, but everything else will.
相关技术资料
Python脚本[摘录]:
Python script [excerpt]:
import subprocess
command="<path>\\start-browser.bat" # Absolute path to Batch file
subprocess.Popen(command,shell=True)
批处理文件:
start /d "C:\Documents and Settings\<Me>\Local Settings\Application Data\Google\Chrome\Application" chrome.exe
系统:
- 的Windows XP SP3 32位
- 的Python 2.7
- Apache 2.2的
推荐答案
我没有你的情况想这一点,但我知道,因为它是每个用户装了很多Chrome的怪异的来的。您是否尝试过以管理员身份登录并安装Chrome为所有用户的?
I haven't tried this in your case, but I know a lot of Chrome's oddities come about because it is installed per user. Have you tried logging in as Administrator and installing Chrome for all users?
这篇关于试图从WSGI / Python的(诚然,快速和肮脏的)胜利Chrome启动。 XP,X86的Python 2.7,Apache 2.2的]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!