FileNotFoundError: No such file or directory

Hello, I’m trying to make a slide puzzle game, using python with pygame,
I’m having a problem with the images in tiles as it won’t move the tiles when the image shows, now it doesn’t recognize the file.

Here is the dictionary where all the images are:

      no = {0:'00.jpg', 1:'01.jpg', 2:'02.jpg', 3:'03.jpg',
  4:'10.jpg', 5:'11.jpg', 6:'12.jpg', 7:'13.jpg',
  8:'20.jpg', 9:'21.jpg', 10:'22.jpg', 11:'23.jpg',
  12:'30.jpg', 13:'31.jpg', 14:'32.jpg', 15:'33.jpg'}

Here is the solved state:

    def getStartingBoard():
# Return a board data structure with tiles in the.
counter = 1
board = []
for x in range(BOARDWIDTH):
    column = list(no.keys())
    for y in range(BOARDHEIGHT):
        column.append(counter)
        counter += BOARDWIDTH
    board.append(column)
    counter -= BOARDWIDTH * (BOARDHEIGHT - 1) + BOARDWIDTH - 1

board[BOARDWIDTH-1][BOARDHEIGHT-1] = BLANK
return board

def getBlankPosition(board):
# Return the x and y of board coordinates of the blank space.
for x in range(BOARDWIDTH):
for y in range(BOARDHEIGHT):
if board[y] == BLANK:
return (x, y)

Here is where the tile is created:

    def drawTile(tilex, tiley, number,path, adjx=0, adjy=0):
# draw a tile at board coordinates tilex and tiley, optionally a few
# pixels over (determined by adjx and adjy)
left, top = getLeftTopOfTile(tilex, tiley)
img = pygame.image.load(path)
DISPLAYSURF.blit(img,(left, top))
textSurf = BASICFONT.render(str(number), True, TEXTCOLOR)
textRect = textSurf.get_rect()
textRect.center = left + int(TILESIZE / 2) + adjx, top + int(TILESIZE / 2) + adjy
DISPLAYSURF.blit(textSurf, textRect)

Here is where the tile is drawn:
def drawBoard(board, message):
DISPLAYSURF.fill(BGCOLOR)
if message:
textSurf, textRect = makeText(message, MESSAGECOLOR, BGCOLOR, 5, 5)
DISPLAYSURF.blit(textSurf, textRect)

count=0
for tilex in range(len(board)):
    for tiley in range(len(board[0])):
        sourceFileDir = os.path.dirname(os.path.abspath(no.get(count)))
        path = os.path.join(sourceFileDir)
        if board[tilex][tiley]:
            drawTile(tilex, tiley, board[tilex][tiley], path = path)
            count=count+1

And, here is the error:


FileNotFoundError Traceback (most recent call last)
C:\Users\GEHADM~1\AppData\Local\Temp/ipykernel_25344/217905245.py in
1 if name == ‘main’:
----> 2 main()

C:\Users\GEHADM~1\AppData\Local\Temp/ipykernel_25344/1636239721.py in main()
13 SOLVE_SURF, SOLVE_RECT = makeText(‘Solve’, TEXTCOLOR, TILECOLOR, WINDOWWIDTH - 120, WINDOWHEIGHT - 30)
14
—> 15 mainBoard, solutionSeq = generateNewPuzzle(80)
16 SOLVEDBOARD = getStartingBoard() # a solved board is the same as the board in a start state.
17 allMoves = # list of moves made from the solved configuration

C:\Users\GEHADM~1\AppData\Local\Temp/ipykernel_25344/2271561387.py in generateNewPuzzle(numSlides)
45 sequence =
46 board = getStartingBoard()
—> 47 drawBoard(board, ‘’)
48 pygame.display.update()
49 pygame.time.wait(500) # pause 500 milliseconds for effect

C:\Users\GEHADM~1\AppData\Local\Temp/ipykernel_25344/942569445.py in drawBoard(board, message)
19 path = os.path.join(sourceFileDir)
20 if board[tilex][tiley]:
—> 21 drawTile(tilex, tiley, board[tilex][tiley], path = path)
22 count=count+1
23

C:\Users\GEHADM~1\AppData\Local\Temp/ipykernel_25344/1166321428.py in drawTile(tilex, tiley, number, path, adjx, adjy)
20 # pixels over (determined by adjx and adjy)
21 left, top = getLeftTopOfTile(tilex, tiley)
—> 22 img = pygame.image.load(path)
23 DISPLAYSURF.blit(img,(left, top))
24 textSurf = BASICFONT.render(str(number), True, TEXTCOLOR)

FileNotFoundError: No such file or directory.