0

Python (2.75) スクリプトから wget を呼び出そうとしています:

cmd = ['wget', 'https://192.168.0.1/003/', '--tries=5', '--http-user=foo', '--http-passwd=bar', '--auth-no-challenge', '--no-check-certificate', '--output-document=temp/page.html']
proc = subprocess.Popen(cmd)
# same with subprocess.call(cmd)

ターミナルでもIDE(Eclipse)で正常に動作しますが、Gnome Schedule User Guide V2.2から実行しようとすると、次のようになります。

--2013-08-16 11:27:35--  https://192.168.0.1/003/
Connecting to 192.168.0.1:443... connected.
ERROR: cannot verify 192.168.0.1's certificate, issued by `blabla': Self-signed certificate encountered.
ERROR: no certificate subject alternative name matches requested host name `192.168.0.1'.
To connect to 192.168.0.1 insecurely, use `--no-check-certificate'.
--2013-08-16 11:27:37--  http://--tries=5/
Resolving --tries=5 (--tries=5)... failed: Name or service not known.
wget: unable to resolve host address `--tries=5'
--2013-08-16 11:27:37--  http://--http-user=foo/
Resolving --http-user=foo (--http-user=foo)... failed: Name or service not known.
wget: unable to resolve host address `--http-user=foo'
--2013-08-16 11:27:37--  http://--http-passwd=bar/
Resolving --http-passwd=bar (--http-passwd=bar)... failed: Name or service not known.
wget: unable to resolve host address `--http-passwd=bar'
--2013-08-16 11:27:37--  http://--auth-no-challenge/
Resolving --auth-no-challenge (--auth-no-challenge)... failed: Name or service not known.
wget: unable to resolve host address `--auth-no-challenge'
--2013-08-16 11:27:37--  http://--no-check-certificate/
Resolving --no-check-certificate (--no-check-certificate)... failed: Name or service not known.
wget: unable to resolve host address `--no-check-certificate'
--2013-08-16 11:27:37--  http://--output-document=temp/page.html
Resolving --output-document=temp (--output-document=temp)... failed: Name or service not known.
wget: unable to resolve host address `--output-document=temp'

...そのため、コマンド「wget arg1 arg2 arg3 ...」を実行する代わりに、「wget arg1」「wget arg2」「wget arg3」を実行しようとしているようです ...

スケジューラから実行すると、何が異なる結果になるかの手がかりはありますか?

スケジューラで使用するコマンドは次のとおりです。「python /home/python/Download/Download.py」

ありがとう

4

1 に答える 1

0

2 番目の引数を最後の位置に移動して、自分で解決しました。

cmd = ['wget', '--tries=5', '--http-user=foo', '--http-passwd=bar', '--auth-no-challenge', '--no-check-certificate', '--output-document=temp/page.html', 'https://192.168.0.1/003/']

現在は機能していますが、なぜターミナルまたは IDE で正常に機能し、スケジューラーから実行したときではないのか疑問に思っています...

于 2013-08-21T09:19:52.820 に答える