当我执行我的外部瓶服务器上我的代码,我得到以下服务器端错误:蟒蛇*仅在服务器列表语法错误,代码本地客户机上工作正常
2017-12-03 02:40:53 ", line
2017-12-03 02:40:53 430
2017-12-03 02:40:53
2017-12-03 02:40:53
2017-12-03 02:40:53 combinedheader = ["Protein", "MW", *listheadersSpC, *listheadersNSAF, *listheadersloge]
2017-12-03 02:40:53
2017-12-03 02:40:53
2017-12-03 02:40:53^
2017-12-03 02:40:53 SyntaxError
2017-12-03 02:40:53 :
2017-12-03 02:40:53 invalid syntax
2017-12-03 02:40:53
这是行导致悲伤的代码:
combinedheader = ["Protein", "MW", *listheadersSpC, *listheadersNSAF, *listheadersloge]
在本地,代码运行得很好。还要注意的是,当在服务器上单独执行下面的代码返回没有错误:
list1 = ['a']
list2 = ['d' , 'e' , 'f']
list3 = ["Hi", "there", *list1, *list2]
print(list3)
Retuns:[ '您好', '有', '一个', 'd', 'E', 'F']
编辑:代码运行在使用Python的虚拟环境的Web应用程序上。 webapp和virtualenv python = 3.6。本地客户端运行相同版本的Python,相同的已安装模块。
I认为你在服务器上使用了错误版本的python(可能是2.x),你最好确认服务器python的版本号 – hsfzxjy
谢谢,我在发布这个问题之前检查了它服务器:版本3.6。本地版本:版本3.6 – PeptideWitch
但是你可能会想到某些东西,也许我在服务器上设置的虚拟环境没有正确传递我的代码,只需再次检查,主服务器使用2.7.6,而我的虚拟环境使用3.6。是吧;会报告回 – PeptideWitch