My instructor uses the Java syntax in Processing, and I’m trying to convert it to Python. The relevant part of his code is:
//Global variables
String fname4 = "gumballs.jpg";
String loadName = fname4;
int ncolors = 8;
//Inside the setup function
String fileName = loadName;
int nc = ncolors;
String paletteName = "palettes" + File.separator + fileName.substring(0, fileName.length()-4) +
"_" + str(nc) + ".bmp";
readPalette(paletteName, colorTable);
Python throws an error saying:
NameError: global name 'File' is not defined
Is there something wrong with the code, or is there a Python alteration needed?