Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

启动 main.py报错 #231

Open
qiusong2613 opened this issue Dec 12, 2018 · 5 comments
Open

启动 main.py报错 #231

qiusong2613 opened this issue Dec 12, 2018 · 5 comments

Comments

@qiusong2613
Copy link

Connected to pydev debugger (build 183.4588.64)
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1741, in
main()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1735, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1135, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/yangjian/pyCharmWorkSpace/test/proxy_pool-master/Run/main.py", line 21, in
from Api.ProxyApi import run as ProxyApiRun
File "../Api/ProxyApi.py", line 22, in
from Util.GetConfig import config
File "../Util/GetConfig.py", line 65, in
config = GetConfig()
File "../Util/GetConfig.py", line 29, in init
self.config_file = ConfigParse(defaults={"password": None})
File "../Util/utilClass.py", line 48, in init
ConfigParser.init(self, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 638, in init
self._read_defaults(defaults)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 1216, in _read_defaults
self.read_dict({self.default_section: defaults})
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 753, in read_dict
self.set(section, key, value)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 1197, in set
self._validate_value_types(option=option, value=value)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 1182, in _validate_value_types
raise TypeError("option values must be strings")
TypeError: option values must be strings

@jhao104
Copy link
Owner

jhao104 commented Dec 12, 2018

@qiusong2613 python3.7版本的configparser不支持None的值,建议你降下版本 2的话用2.7, 3的话用3.6

@qiusong2613
Copy link
Author

报错的时候 ,我用的就是3.6的版本 不过我修改了下代码 现在可以了

@likenji
Copy link

likenji commented Dec 16, 2018

建议修改成:
self.config_file = ConfigParse(defaults={"password": ""})
可兼容py3.7

@bytebuff
Copy link

bytebuff commented Dec 17, 2018

觉得将配置文件改为Python文件更好一些,ini文件有时候会莫名出错,感觉兼容性不好,建议可以改成类似于Scrapy的配置文件。

@xinyu3ru
Copy link

GetConfig.py
29行改为
self.config_file = ConfigParse(defaults={"password": ""})
或者
self.config_file = ConfigParse(defaults={"password": "123456"})

可以有效绕开这个错误

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants