I give you my solver.py file, and then the error message.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import init
import os
import csv
from kudoSudoku import sudoku
from pprint import pprint
filename = os.path.abspath( 'C:/Users/Sylvain/numbers.csv' )
with open (filename) as csvfile:
creader = csv.reader(csvfile, delimiter = ' ' )
for row in creader:
print ( ', ' .join(row))
with open ( 'numbers.csv' , newline = '') as csvfile:
puzzle = csv.reader(csvfile, delimiter = ' ' , quotechar = '|' )
for row in puzzle:
print ( ', ' .join(row))
matrix = row
for i in range ( 9 ):
matrix[i] = eval (matrix[i])
print ( 'sylvain' )
print (matrix)
pprint(matrix)
table = sudoku(matrix)
result = table.solve()
pprint(result)
|
And now the error message:
Error:
λ python solver.py
|[0,, 9,, 0,, 0,, 0,, 0,, 0,, 0,, 0]|, |[1,, 0,, 0,, 0,, 0,, 6,, 8,, 7,, 2]|, |[0,, 0,, 2,, 1,, 0,, 0,, 0,, 3,
, 0]|, |[0,, 0,, 1,, 0,, 4,, 0,, 0,, 6,, 0]|, |[0,, 2,, 0,, 0,, 0,, 0,, 0,, 0,, 5]|, |[0,, 0,, 9,, 0,, 7,, 0,,
0,, 2,, 0]|, |[0,, 0,, 7,, 5,, 0,, 0,, 0,, 4,, 0]|, |[8,, 0,, 0,, 0,, 0,, 4,, 7,, 1,, 3]|, |[0,, 1,, 0,, 0,,
0,, 0,, 0,, 0,, 0]|
Traceback (most recent call last):
File "solver.py", line 16, in <module>
with open('numbers.csv', newline='') as csvfile:
FileNotFoundError: [Errno 2] No such file or directory: 'numbers.csv'