當我執行我的外部瓶服務器上我的代碼,我得到以下服務器端錯誤:蟒蛇*僅在服務器列表語法錯誤,代碼本地客戶機上工作正常
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