Multiple issues with Linux-Python3.6 and Windows-Python3.7
chuhoaianh opened this issue · 0 comments
First of all, thank you for making this wonderful package.
I got 2 problems when running on 2 environments:
Script:
- The "Simple example" provided here
Environments:
- Linux-Python 3.6.8 and Windows-Python 3.7.3
- dash-uploader==0.7.0a1
The problems:
- ImportError: cannot import name 'final' from 'typing'
Traceback (most recent call last):
File "C:\Users\user123\eclipse-workspace\For fun - Python\test7.py", line 3, in <module>
import dash_uploader as du
File "C:\Users\user123\AppData\Local\Programs\Python\Python37\lib\site-packages\dash_uploader\__init__.py", line 7, in <module>
from dash_uploader.configure_upload import configure_upload
File "C:\Users\user123\AppData\Local\Programs\Python\Python37\lib\site-packages\dash_uploader\configure_upload.py", line 5, in <module>
from dash_uploader.httprequesthandler import HttpRequestHandler
File "C:\Users\user123\AppData\Local\Programs\Python\Python37\lib\site-packages\dash_uploader\httprequesthandler.py", line 11, in <module>
from dash_uploader.utils import retry
File "C:\Users\user123\AppData\Local\Programs\Python\Python37\lib\site-packages\dash_uploader\utils.py", line 2, in <module>
from typing import final
ImportError: cannot import name 'final' from 'typing' (C:\Users\user123\AppData\Local\Programs\Python\Python37\lib\typing.py)
This can be fixed by:
a. Commenting out from typing import final
from utils.py (not sure whats the side effects by doing this)
b. Change from typing import final
-> from typing_extensions import final
(for python 3.7 and below)
For this problem, you might need to change the requirement might be python 3.8+ (I think python3.8 typing
has final
, though I havent checked), not python3.6+.
- pathlib.Path obj has no attribute 'write'
Linux: AttributeError: 'PosixPath' object has no attribute 'write'
Windows: AttributeError: 'WindowsPath' object has no attribute 'write'
Error message in Windows
Traceback (most recent call last):
File "C:\Users\user123\AppData\Local\Programs\Python\Python37\lib\site-packages\dash_uploader\httprequesthandler.py", line 85, in post
return self._post()
File "C:\Users\user123\AppData\Local\Programs\Python\Python37\lib\site-packages\dash_uploader\httprequesthandler.py", line 110, in _post
r.chunk_data.save(chunk_file)
File "C:\Users\user123\AppData\Local\Programs\Python\Python37\lib\site-packages\werkzeug\datastructures.py", line 2803, in save
copyfileobj(self.stream, dst, buffer_size)
File "C:\Users\user123\AppData\Local\Programs\Python\Python37\lib\shutil.py", line 82, in copyfileobj
fdst.write(buf)
AttributeError: 'WindowsPath' object has no attribute 'write'
To make this works, I have to edit: r.chunk_data.save(chunk_file)
-> r.chunk_data.save(str(chunk_file))
in _post()
("httprequesthandler.py"). After this, files are uploaded normally.
Am I missing anything to make this work without editing the files?