【发布时间】:2021-06-21 14:29:50
【问题描述】:
我想解析一个开放存取的数据集。
def parse():
zipurl = 'xyz'
with tempfile.NamedTemporaryFile(zipurl) as tfile:
# Write the contents of the file into the temporary file
tfile.write(zipurl.read())
# Set the file's current position at the offset
tfile.seek(0)
# Unpack the archive file in the parent directory
parent = Path(unpack_archive(tfile.name, '/tmp/dataset', format='zip')).parent)
for file in parent.iterdir():
if file.is_file():
old_name = file.stem
extension = file.suffix
directory = file.parent
错误: 预期类型 'Union[str, PathLike[str]]',改为 'None'
错误是在parent = Path(unpack_archive(tfile.name, '/tmp/dataset', format='zip')).parent)提出的
我的pycharm版本是Edu 2021.1.1
【问题讨论】:
-
你有什么pycharm版本?在哪一行发出警告?
标签: python python-3.x pycharm