2013-01-18 32 views
1

系統信息: Windows 7中, GNU Wget的1.11.4, 的Python 2.6窗口wget的與被切斷

問題:

進出口運行觸發一個wget的快捷方式的python腳本,問題那是wget(即使純粹從exe中運行命令行)切斷'&'s。例如,當我運行下面的代碼,這是我得到:

C:\Program Files\GnuWin32\bin>wget.exe http://www.imdb.com/search/title?genres=action&sort=alpha,asc&start=51&title_type=feature

SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc syswgetrc = C:\Program Files\GnuWin32/etc/wgetrc

--2013-01-18 12:48:43-- http://www.imdb.com/search/title?genres=action Resolving www.imdb.com... 72.21.215.52 Connecting to www.imdb.com|72.21.215.52|:80... failed: Connection refused.

=alpha,ascThe system cannot find the file specified.

The system cannot find the file 51. 'title_type' is not recognized as an internal or external command, operable program or batch file.

正如你所看到的,wget的計數之前的「&」的相關網址的所有文字,窗戶走過去半個世紀爲新的命令。

必須有某種方式允許wget捕獲整個字符串作爲URL。

在此先感謝。

編輯: 當我打電話與它周圍的括號的命令行命令,它的偉大工程,但是,當我通過蟒蛇運行腳本:

subprocess.Popen(['start /B wget.lnk --directory-prefix=' + output_folder + ' --output-document=' + output_folder + 'this.html "http://www.imdb.com/search/title?genres=action&sort=alpha,asc&start=51&title_type=feature"'], shell=True) 

我收到以下錯誤:

SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc

syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc

"http://www.imdb.com/search/title?genres=action&sort=alpha,asc&start=51&title_ty pe=feature": Unsupported scheme.

回答

1

這不是Wget中斷URL,而是命令解釋器,它使用&分隔兩個命令,類似於;。這由以下行上的=alpha,ascThe system cannot find the file specified.錯誤指示。

爲了防止這種情況發生,引用整個網址:

wget.exe "http://www.imdb.com/search/title?genres=action&sort=alpha,asc&start=51&title_type=feature" 
+0

謝謝哥們,我現在已經是從蟒蛇踢它關閉的唯一問題 – user1747683