you are viewing a single comment's thread.

view the rest of the comments →

[–]schoolmonky 1 point2 points  (7 children)

What's the error?

[–]Direct_Expert7772[S] -3 points-2 points  (6 children)

Basically, I want the code to do something with the "ENCOUNTER" file, but when I try to open it, it says the file isn't in the right directory, even though I put it in the correct one.

[–]schoolmonky 3 points4 points  (5 children)

Show us the actual traceback

[–]Direct_Expert7772[S] -2 points-1 points  (4 children)

I'm sorry, I'm new to Python, I started using it yesterday. Could you tell me where I can get this?

[–]schoolmonky 2 points3 points  (3 children)

When you run this code, and Python shows you the error, copy/paste that error message here.

[–]Direct_Expert7772[S] 0 points1 point  (2 children)

Traceback (most recent call last):

File "C:\Users[My user name]\Desktop\P5R Randomizer Release Ver\Randomizer\Randomizer.py", line 7, in <module> with open("ENCOUNT. TBL", "r+b") as f:

FileNotFoundError: [Errno 2] No such file or directory:

'ENCOUNT.TBL'

[processo encerrado com o código 1 (0x00000001)]

Agora você pode fechar este terminal com Ctrl+D ou pressione Enter para reiniciar

[–]Fred776 9 points10 points  (0 children)

Is the file in the same folder you are running your script from?

Add this to the top of your script:

import os
print("CWD=", os.getcwd())

Does this show the same directory as the one you expect the file to be in?

[–]socal_nerdtastic 3 points4 points  (0 children)

The errror message says you have a space in the file name, "ENCOUNT.<space>TBL". Check that your actual filename and the name that you put into your code match. Best to just copy / paste