【问题标题】:Python cgi script how to print links to images from directoryPython cgi脚本如何打印目录中图像的链接
【发布时间】:2014-08-02 02:12:44
【问题描述】:

我想知道您将如何打印指向您目录中图像的链接。我试着弄乱了一点,到目前为止它不起作用。

#!/usr/local/bin/python3

print('Content-type: text/html\n')

print ('<img src="/~NAME/images/figure_1.png">')

错误:

 CGIWrap encountered an error while attempting to execute this script:

Error Message: No such file or directory
Error Number: 2 

【问题讨论】:

  • 当我运行 url 时,我得到了我刚刚发布的错误

标签: python html image cgi


【解决方案1】:

你应该添加单引号。

- print (<img src="/~NAME/images/figure_1.png">)
+ print ('<img src="/~NAME/images/figure_1.png">')

【讨论】:

  • 如果显示错误怎么办?如果文件权限那么chmod 755 FILENAME.cgi
猜你喜欢
  • 2017-03-19
  • 2013-10-16
  • 2014-04-29
  • 2014-12-19
  • 2012-01-15
  • 2022-10-14
  • 2021-06-26
  • 1970-01-01
  • 2011-03-11
相关资源
最近更新 更多