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

OSError: [Errno 22] Invalid argument: #17

Open
zysforever opened this issue Mar 22, 2020 · 8 comments
Open

OSError: [Errno 22] Invalid argument: #17

zysforever opened this issue Mar 22, 2020 · 8 comments

Comments

@zysforever
Copy link

我在项目的baike目录下运行scrapy crawl baike,结果报错“OSError: [Errno 22] Invalid argument: 'D:\code\program\WEB_KG-master\baike\logs\Sun_Mar_22_21:30:37_2020.log' ”,请问该怎么解决呢?感激不尽!
}69AD$0HQQX15)QEG(3DB8G

@molyswu
Copy link

molyswu commented Jun 5, 2020

same issus

@lixiang0
Copy link
Owner

lixiang0 commented Jun 5, 2020

我猜是:的问题,请把时间中间的:去掉就行。这是Windows系统命名规范导致的。

@molyswu
Copy link

molyswu commented Jun 6, 2020

@lixiang0 具体更改那一个文件,那一行代码?
WEB_KG\baike\spiders\baike.py", line 17, in
format='%(levelname)s - %(asctime)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S')
File "e:\anaconda3\lib\logging_init_.py", line 1895, in basicConfig

@lixiang0
Copy link
Owner

lixiang0 commented Jun 8, 2020

@lixiang0 具体更改那一个文件,那一行代码?
WEB_KG\baike\spiders\baike.py", line 17, in
format='%(levelname)s - %(asctime)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S')
File "e:\anaconda3\lib\logging__init__.py", line 1895, in basicConfig

datefmt='%d-%b-%y %H:%M:%S'中的:改为_

@molyswu
Copy link

molyswu commented Jun 9, 2020

@lixiang0 更改datefmt='%d-%b-%y %H:%M:%S'中的:改为_ ,有同样的问题
WEB_KG_0\WEB_KG_0\baike\spiders\baike.py", line 17, in
format='%(levelname)s - %(asctime)s - %(message)s', datefmt='%d-%b-%y %H_%M_%S')
File "e:\anaconda3\lib\logging_init_.py", line 1895, in basicConfig
h = FileHandler(filename, mode)
File "e:\anaconda3\lib\logging_init_.py", line 1087, in init
StreamHandler.init(self, self.open())
File "e:\anaconda3\lib\logging_init
.py", line 1116, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
Thanks

@lixiang0
Copy link
Owner

lixiang0 commented Jun 9, 2020

@lixiang0 更改datefmt='%d-%b-%y %H:%M:%S'中的:改为_ ,有同样的问题
WEB_KG_0\WEB_KG_0\baike\spiders\baike.py", line 17, in
format='%(levelname)s - %(asctime)s - %(message)s', datefmt='%d-%b-%y %H_%M_%S')
File "e:\anaconda3\lib\logging__init__.py", line 1895, in basicConfig
h = FileHandler(filename, mode)
File "e:\anaconda3\lib\logging__init__.py", line 1087, in init
StreamHandler.init(self, self.open()) File "e:\anaconda3\lib\logging__init_.py", line 1116, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
Thanks

D:\code\program\WEB_KG-master\baike\logs\Sun_Mar_22_21:30:37_2020.log中logs目录有吗?

@molyswu
Copy link

molyswu commented Jun 10, 2020

@lixiang0 WEB_KG_0\baike\logs\的logs目录下为空

@lixiang0
Copy link
Owner

@lixiang0 WEB_KG_0\baike\logs\的logs目录下为空

如果路径完全正确,那应该就是文件名的问题,先把logger这块注释掉吧,不影响。

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

3 participants