xuruidong commented on PR #8623:
URL: https://github.com/apache/apisix/pull/8623#issuecomment-1376802719
> Could you provide a standalone test to show us why changing a filename can
fix "AttributeError: module 'requests' has no attribute 'put'"?
在用python 执行脚本时, 脚本的所在路径会被加入 sys.path 中。比如在脚本中加入 print ("sys.path = ",
sys.path), 会得到:
```
python ssl.py
sys.path = ['E:\\xrd\\code\\tmp',
'D:\\Programs\\Python\\Python37\\python37.zip',
'D:\\Programs\\Python\\Python37\\DLLs', 'D:\\Programs\\Python\\Pyt
hon37\\lib', 'D:\\Programs\\Python\\Python37',
'D:\\Programs\\Python\\Python37\\lib\\site-packages']
```
E:\\xrd\\code\\tmp 是 ssl.py 所在的目录。
在使用 requests 进行http 请求时,会有 import ssl ( 从本次pr 的描述中的异常信息里可以看到), 这时 会在
sys.path 中查找 ssl.py 。 如果测试脚本用了相同的名字,那么import 的真正文件是
E:\\xrd\\code\\tmp\\ssl.py , 而不是系统下的 ssl.py
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]