2017-08-14 169 views
0

我想弄清楚使用Python发生的错误。我正在尝试使用由klustakwik团队免费发布的模块detektspikes.py。attributeerror'模块'对象没有属性'openfile'

我遇到运行时发生的错误。

错误日志:

Exiting directory C:\Users\user\Downloads\klusta-team-spikedetekt-82bcf06\klusta 
-team-spikedetekt-82bcf06\scripts_1 
Traceback (most recent call last): 
File "C:\Users\user\Downloads\klusta-team-spikedetekt-82bcf06\klusta-team-spik 
edetekt-82bcf06\scripts\detektspikes.py", line 82, in <module> 
spike_detection_job(raw_data_files, probe_file, output_dir, output_name) 
File "C:\Python27\lib\site-packages\spikedetekt\core.py", line 86, in 
spike_de 
tection_job 
probe, max_spikes) 
File "C:\Python27\lib\site-packages\spikedetekt\core.py", line 115, in 
spike_d 
etection_from_raw_data 
h5s[n] = tables.openFile(filename, 'w') 
AttributeError: 'module' object has no attribute 'openFile' 

我想这个问题是在core.py

Core.py:

Filter, detect, extract from raw data. 
""" 
### Detect spikes. For each detected spike, send it to spike writer, which 
### writes it to a spk file. List of times is small (memorywise) so we just 
### store the list and write it later. 

np.savetxt("dat_channels.txt", Channels_dat, fmt="%i") 

# Create HDF5 files 
h5s = {} 
h5s_filenames = {} 
for n in ['main', 'waves']: 
    filename = basename+'.'+n+'.h5' 
    h5s[n] = tables.openFile(filename, 'w') 
    h5s_filenames[n] = filename 
for n in ['raw', 'high', 'low']: 
    if Parameters['RECORD_'+n.upper()]: 
     filename = basename+'.'+n+'.h5' 
     h5s[n] = tables.openFile(filename, 'w') 
     h5s_filenames[n] = filename 
main_h5 = h5s['main'] 
# Shanks groups 
shanks_group = {} 
shank_group = {} 
shank_table = {} 
for k in ['main', 'waves']: 
    h5 = h5s[k] 
    shanks_group[k] = h5.createGroup('/', 'shanks') 
    for i in probe.shanks_set: 

我会高兴能够帮助好心!

回答

1

问题是,该代码是针对Python的一个非常旧的版本,并试图访问不再存在的方法tables。请参见:http://www.pytables.org/MIGRATING_TO_3.x.html

如果要运行该脚本,则必须使用旧版本的Python(如2.3)来运行该脚本,或更新使用openFile来代替使用的行。虽然我可能还有其他不兼容的情况,但我不知道。

+0

谢谢!我通过编辑open_file来解决它。 –

相关问题