Text window: Python errors on input/output
Issue #222
closed
Trying to save text will result in the following error
An error has occurred while executing Python code:
TypeError: expected str, bytes or os.PathLike object, not tuple
Traceback (most recent call last):
File "C:/Users/geo_fath/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\docks.py", line 625, in
self.btnSaveFile.clicked.connect(lambda: self.save(saveAs=False))
File "C:/Users/geo_fath/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\docks.py", line 658, in save
ext = os.path.splitext(self.mFile)[-1].lower()
File "O:\Student_Data\geo_fath\OSGeo\apps\Python37\lib\ntpath.py", line 202, in splitext
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not tuple
trying to open a file:
An error has occurred while executing Python code:
TypeError: stat: path should be string, bytes, os.PathLike or integer, not tuple
Traceback (most recent call last):
File "C:/Users/geo_fath/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\docks.py", line 624, in
QFileDialog.getOpenFileName(self, 'Open File', directory=self.mFile, filter=TextDockWidget.FILTERS)))
File "C:/Users/geo_fath/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\docks.py", line 629, in loadFile
if os.path.isfile(path):
File "O:\Student_Data\geo_fath\OSGeo\apps\Python37\lib\genericpath.py", line 30, in isfile
st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not tuple
after one of the errors above sometimes no button will work, causing the following error:
2019-01-14T11:46:55 WARNING Traceback (most recent call last):
File "C:/Users/geo_fath/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\docks.py", line 624, in
QFileDialog.getOpenFileName(self, 'Open File', directory=self.mFile, filter=TextDockWidget.FILTERS)))
TypeError: getOpenFileName(parent: QWidget = None, caption: str = '', directory: str = '', filter: str = '', initialFilter: str = '', options: Union[QFileDialog.Options, QFileDialog.Option] = 0): argument 'directory' has unexpected type 'tuple'
Comments (4)
-
-
- changed status to open
-
- changed status to closed
-
reporter Saving works, opening a text file causes
An error has occurred while executing Python code: TypeError: stat: path should be string, bytes, os.PathLike or integer, not tuple Traceback (most recent call last): File "C:/Users/ThinkPad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\docks.py", line 562, in QFileDialog.getOpenFileName(self, 'Open File', directory=self.mFile, filter=TextDockWidget.FILTERS))) File "C:/Users/ThinkPad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapbox\gui\docks.py", line 608, in loadFile if os.path.isfile(path): File "C:\OSGEO4~1\apps\Python37\lib\genericpath.py", line 30, in isfile st = os.stat(path) TypeError: stat: path should be string, bytes, os.PathLike or integer, not tuple Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS version: 3.12.0-București București, cd141490ec
- Log in to comment
@thielfab does the error still occur?