---------------------------------------------------------------------------
UnicodeEncodeError Traceback (most recent call last) Cell In[16], line 2 1 for f in file_lst: ----> 2 df = mikeio.read(f).to_dataframe() File C:\py_venv\py_leafmap\Lib\site-packages\mikeio\__init__.py:133, in read(filename, items, time, keepdims, **kwargs) 130 if "dfs" not in ext: 131 raise ValueError("mikeio.read() is only supported for Dfs files") --> 133 dfs = open(filename) 135 return dfs.read(items=items, time=time, keepdims=keepdims, **kwargs) File C:\py_venv\py_leafmap\Lib\site-packages\mikeio\__init__.py:186, in open(filename, **kwargs) 180 raise Exception( 181 f"{ext} is not a supported format for mikeio.open. Valid formats are {valid_formats}" 182 ) 184 reader_klass = READERS[ext] --> 186 return reader_klass(filename, **kwargs) File C:\py_venv\py_leafmap\Lib\site-packages\mikeio\dfs\_dfs0.py:101, in Dfs0.__init__(self, filename) 98 if not path.exists(): 99 raise FileNotFoundError(path) --> 101 dfs = DfsFileFactory.DfsGenericOpen(str(path)) 102 self._source = dfs 104 # Read items File C:\py_venv\py_leafmap\Lib\site-packages\mikecore\DfsFileFactory.py:84, in DfsFileFactory.DfsGenericOpen(filename, parameters) 81 @staticmethod 82 def DfsGenericOpen(filename, parameters = None): 83 dfs = DfsFile(); ---> 84 dfs.Open(filename, DfsFileMode.Read, parameters); 85 return dfs File C:\py_venv\py_leafmap\Lib\site-packages\mikecore\DfsFile.py:726, in DfsFile.Open(self, filename, mode, parameters) 724 # Marshal filename string to C char* 725 fnp = ctypes.c_char_p() --> 726 fnp.value = filename.encode("cp1252") 728 if mode is DfsFileMode.Read: 729 # Open file for reading 730 rok = DfsDLL.Wrapper.dfsFileRead( 731 fnp.value, ctypes.byref(self.headPointer), ctypes.byref(self.filePointer) 732 ) File ~\AppData\Local\Programs\Python\Python312\Lib\encodings\cp1252.py:12, in Codec.encode(self, input, errors) 11 def encode(self,input,errors='strict'): ---> 12 return codecs.charmap_encode(input,errors,encoding_table) UnicodeEncodeError: 'charmap' codec can't encode character '\u5e74' in position 10: character maps to <undefined> encoding with 'cp1252' codec failed
没有评论:
发表评论