2017-08-14 231 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來解決它。 –

相關問題