r/learnpython • u/hanjokazooie • 14m ago
Trying to import a file into Thonny
Trying to import a rom file to convert to bytes and then mod, but the game title has "of" in it, so it returns as a syntax error. I guess the IDE thinks I'm trying to write an if statement? Anyway, google wasn't helpful, so i came here.
Code below
import Breath of Fire II (USA) - Copy.sfc
1
Upvotes
•
u/D3str0yTh1ngs 9m ago
I will just start of by telling you that a binary file is not a python file and so using
importon it makes no sense. Do something like this to read in the file:contentsis thrus a variable containing the bytes of the file•
u/Ender_Locke 4m ago
also you can’t have spaces like that. that’s like programming and file directories 101
•
u/argh1989 12m ago
Import is for modules, not files.