I am using the json2html package to convert JSON to HTML but I am getting the error - "fork/exec /home/sftp_user/uploads/json2html.py: exec format error"
以下是我所做的
- 脚本如下所示**
#!/usr/bin/env python3
import sys
from json2html import *
from json import loads
ip = json.loads(sys.argv[1])
res = json2html.convert(json={"data":ip})
sys.stdout.write(res)
- sys.argv [1]负载低于**
[ { "FirstName": "John", "LastName": "Doe", "StreetName": "120 jefferson st.", "County": "Riverside", "State": " NJ", "PostCode": 8075 }, { "FirstName": "Jack", "LastName": "McGinnis", "StreetName": "220 hobo Av.", "County": "Phila", "State": " PA", "PostCode": 9119 }, { "FirstName": "John \"Da Man\"", "LastName": "Repici", "StreetName": "120 Jefferson St.", "County": "Riverside", "State": " NJ", "PostCode": 8075 }, { "FirstName": "Stephen", "LastName": "Tyler", "StreetName": "7452 Terrace \"At the Plaza\" road", "County": "SomeTown", "State": "SD", "PostCode": 91234 }, { "FirstName": null, "LastName": "Blankman", "StreetName": null, "County": "SomeTown", "State": " SD", "PostCode": 298 }, { "FirstName": "Joan \"the bone\", Anne", "LastName": "Jet", "StreetName": "9th, at Terrace plc", "County": "Desert City", "State": "CO", "PostCode": 123 } ]
- 错误**
fork/exec /home/sftp_user/uploads/json2html.py: exec format error
你知道代码中有什么问题吗?
2条答案
按热度按时间rxztt3cl1#
您输入的JSON中的
null
值似乎有问题。请尝试先将其转换为None
,然后就可以了输出:
tvmytwxo2#
经过数小时的故障排除,发现脚本文件名“json2html.py“导致了问题(与包名json2html冲突)。更改脚本文件名后,脚本开始工作。