今天做CHB-MIT数据集将其进行STFT转换时,运行有关hickle库的代码遭遇这样的问题,找遍全网也没有相关解释
我的代码:
with open(filename, 'w') as f:
hickle.dump(data, f, mode='w')
我的filename明明是可用字符路径:./tempdata2/CHBMIT_SZPred_GAN\ictal_1.hickle
(其实也是今天才发现python中同一路径下/和\可以同时出现哈哈)
以下是路径追溯,报错原因:
Traceback (most recent call last):
File "test.py", line 76, in <module>
main(dataset=args.dataset, build_type=args.mode, sph=args.sph)
File "test.py", line 56, in main
LoadSignals(target, type='ictal', settings=settings, sph=sph).apply(
File "D:\PyCharm\project-AutoDL\seizure-prediction-GAN-master\utils\load_signals.py", line 423, in apply
save_hickle_file(
File "D:\PyCharm\project-AutoDL\seizure-prediction-GAN-master\myio\save_load.py", line 10, in save_hickle_file
hickle.dump(data, f, mode='w')
File "D:\Anaconda3\envs\tensorflow2-4\lib\site-packages\hickle\hickle.py", line 218, in dump
h5f, path, close_flag = file_opener(file_obj, path, mode,filename)
File "D:\Anaconda3\envs\tensorflow2-4\lib\site-packages\hickle\fileio.py", line 216, in file_opener
raise FileError(
hickle.fileio.FileError: 'file_obj' must be a valid path string, pahtlib.Path, h5py.File, h5py.Group, h5py.Dataset, file or file like object'
居然说我的file_obj不是可用字符串路径,纳尼??报错的具体原因我也不太清楚,应该是新版本的hickle导致,我将其换回了旧版本3.4.3问题解决o(* ̄▽ ̄*)ブ
pip uninstall hickle
pip install hickle==3.4.3
希望能帮到你