python - Python 3.6.4 脚本在调试模式下工作,但在终端上运行时返回错误
问题描述
我在窗口 10 上使用带有 Visual Studio Code 的 python 3.6。我正在使用 API 从 SmartSheet 中提取数据。这是我的代码。
import smartsheet
import importlib
import supporting_tools as spt
Token = 'api_token'
sheet_id_2nd = 'sheet_id'
sheet_id_3rd = 'sheet_id'
sheet2nd = spt.read_sheet (Token, sheet_id_2nd)
sheet3rd = spt.read_sheet (Token, sheet_id_3rd)
col_map_2nd = spt.col_list (sheet2nd)
col_map_3rd = spt.col_list (sheet3rd)
print(col_map_2nd)
id_set_2nd = set()
id_set_3rd = set()
for row in sheet2nd.rows:
Id_cell = spt.get_cell_by_column_name(row, "Row ID", col_map_2nd)
id_set_2nd.add(Id_cell.display_value)
print(id_set_2nd)
for row in sheet3rd.rows:
Id_cell = spt.get_cell_by_column_name(row, "Row ID", col_map_3rd)
id_set_3rd.add(Id_cell.display_value)
print(id_set_3rd)
当我在调试模式下运行它时它工作正常,但当我在终端中运行它时返回此错误。我搜索了一个解决方案,似乎 iPython 有问题,但我不确定。有什么建议吗?
"C:/Users/Jay Choi/AppData/Local/Programs/Python/Python36/python.exe" "c:/Users/Jay Choi/Desktop/New folder/main.py"
File "<stdin>", line 1
"C:/Users/Jay Choi/AppData/Local/Programs/Python/Python36/python.exe" "C:/Users/Jay Choi/Desktop/New folder/main.py"
^
SyntaxError: invalid syntax
解决方案
推荐阅读
- python - 由于某种原因,渲染模板不起作用
- android - 有条件地使用库
- android - 在 Android 中使用 Utils.bitmapToMat 时发生错误
- node.js - 将数据传递给构造函数给了我未定义的
- c - MPI_Programs 中是否有任何方法可以命令进程的执行?
- android - AVD Pixel_4_XL_API_30 的模拟器进程被杀死
- python - 如何在 Python 中使用自定义对象 ID 在 MongoDB 中插入文档
- c++ - 类变量无法正常工作,因为我想要重载 operator=
- c - STM32F103蓝色药丸-与闪烁的led裸机有关的问题
- reactjs - React(Hooks):必须手动刷新页面才能看到用户