我有以下代码:
import json
import os
from botocore.vendored import requests
from custom_validator import CustomValidator
dev_mode = 'DEV' in os.environ
access_token = None
if dev_mode:
import test_config as config
else:
import config as config
def myfunc(data):
if not (access_token):
.....
但是在myfunc
内部,我在尝试使用access_token
时得到了Unresolved reference
错误。
即使我在上面的初始化中把global
放在它前面,我也会得到:
Global variable 'access_token' is undefined in the module level
我有点困惑-为什么会发生这种情况,我该怎么解决?你知道吗
使用python3.6。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐