I can't quite figure out what is making this script of mine hang (Ie. Whole spyder stopped working). Is it something to do with my code or that some of my Spyder/python files are corrupted?
#Import relevant modules
import os
import numpy as np
import csv
C1adaptS = 0
CN2adaptS = 0
N3adaptS = 0
NS4adaptS = 0
S5adaptS = 0
C1adaptC = 0
CN2adaptC = 0
N3adaptC = 0
NS4adaptC = 0
S5adaptC = 0
#Paste filename to be analysised here (The .csv file)
filename = 'PartID_WK_plottest.xls'
#Change directory to file's location
os.chdir('C:\Users\Aaron\Desktop\Experiments\Dotty_Simplified_(FINAL)')
loadcsv = open(filename, 'r')
for line in loadcsv.readlines():
line = line.strip()
#Split the words within the line
trialnum, stimulus, stimulus_location, response, more_sin_like, sin_adapt = line.split(',')
if stimulus == 'C1' and more_sin_like == 1 and sin_adapt == 1:
C1adaptS += 1
elif stimulus == 'CN2' and more_sin_like == 1 and sin_adapt == 1:
CN2adaptS += 1
elif stimulus == 'N3' and more_sin_like == 1 and sin_adapt == 1:
N3adaptS += 1
elif stimulus == 'NS4' and more_sin_like == 1 and sin_adapt == 1:
NS4adaptS += 1
elif stimulus == 'S5' and more_sin_like == 1 and sin_adapt == 1:
S5adaptS += 1
elif stimulus == 'C1' and more_sin_like == 1 and sin_adapt == 0:
C1adaptC += 1
elif stimulus == 'CN2' and more_sin_like == 1 and sin_adapt == 0:
CN2adaptC += 1
elif stimulus == 'N3' and more_sin_like == 1 and sin_adapt == 0:
N3adaptC += 1
elif stimulus == 'NS4' and more_sin_like == 1 and sin_adapt == 0:
NS4adaptC += 1
elif stimulus == 'S5' and more_sin_like == 1 and sin_adapt == 0:
S5adaptC += 1
print C1adaptS
print CN2adaptS
print N3adaptS
print NS4adaptS
print S5adaptS
print C1adaptC
print CN2adaptC
print N3adaptC
print NS4adaptC
print S5adaptC
Perhaps a keen eye can spot the problem if it truly is a code error. I can't seem to pick up any.