【问题标题】:windows wget & being cut offwindows wget & 被切断
【发布时间】:2013-01-02 02:03:54
【问题描述】:

系统信息: Windows 7的, GNU Wget 1.11.4, Python 2.6

问题:

我正在运行一个触发 wget 快捷方式的 python 脚本,问题是 wget(即使纯粹在 exe 命令行中运行)会切断“&”。例如,当我运行下面的代码时,这就是我得到的:

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 文件\GnuWin32/etc/wgetrc

--2013-01-18 12:48:43-- http://www.imdb.com/search/title?genres=action 正在解决 www.imdb.com... 72.21.215.52 连接到 www.imdb.com|72.21.215.52|:80... 失败:连接被拒绝。

=alpha,asc系统找不到指定的文件。

系统找不到文件 51. 'title_type' 不被识别为内部或 外部命令、可运行程序或批处理文件。

如您所见,wget 将 '&' 之前的所有文本计算为相关 URL,而 windows 将后半部分作为新命令。

必须有某种方法允许 wget 将整个字符串捕获为 URL。

提前致谢。

编辑: 当我在命令行中用括号调用命令时,它工作得很好,但是,当我通过 python 运行脚本时:

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": 不支持的方案。

【问题讨论】:

    标签: python windows command-line command wget


    【解决方案1】:

    截断 URL 的不是 Wget,而是命令解释器,它使用& 分隔两个命令,类似于;。这由以下行中的 =alpha,ascThe system cannot find the file specified. 错误指示。

    为防止这种情况发生,请引用整个 URL:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-13
      • 1970-01-01
      • 1970-01-01
      • 2023-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-07
      相关资源
      最近更新 更多