The function addColumn(String) does not exist

Hello!
I tried running this Table code from the page of Processing https://processing.org/reference/Table.html

Table table;

void setup() {

  table = new Table();
  
  table.addColumn("id");
  table.addColumn("species");
  table.addColumn("name");
  
  TableRow newRow = table.addRow();
  newRow.setInt("id", table.lastRowIndex());
  newRow.setString("species", "Panthera leo");
  newRow.setString("name", "Lion");
  
  saveTable(table, "data/new.csv");
}

// Sketch saves the following to a file called "new.csv":
// id,species,name
// 0,Panthera leo,Lion

but it says that the addColumn function does not exist.
I used to have the v3 and I thought updating it to the v4 (4.1.1) it would work. I already deleted the v3 folder thinking it was overlapping but the same error keeps appearing.

I have tried this code in both 3.5.4 and 4.0.1 and they both executed without any error messages being generated.

Perhaps someone else can try 4.1.1 as I have not downloaded it yet.

Runs ok here with Processing 4.1.1; comma separated file is saved in ‘data’ folder. I always thought that this was a deceiving demo name. You never see a table unless you open the .csv file with a spreadsheet app.

If it works for the both of you, maybe the problem lies in my laptop. I’ll try and delete the v4 and downloading it again. Move the folder to another place and see what happens.

Usually the Processing folder is inside the Documents folder.

I usually have all my apps inside the download folder. I’ll move it to the Documents one then.

This refers to the folder where you store your sketches, not where you store the installed Processing app.

1 Like

Now it works. I had to change the name of the file to the same as the folder where it was. Oops.
Now that I have that solved, I have to go back to the code that I was originally working on and finish solving it :v. Thanks people!

1 Like

I don’t worry about where the Processing app is installed on a Mac; it automatically goes in the Applications folder. Windows is a different cat; would go in C:\ProgramFiles I’m guessing. Problem is it starts off in the Downloads folder and has to be moved from where it starts. Makes a difference if it is a .zip file or an .exe, then we get into ‘extracting’ and directing where it goes. I like my Mac.

  • Mac is the only Processing version w/ an actual install, which the OS recognizes as registered.
  • Both Windows & Linux versions are presented in a standalone compressed file.
  • We need to decide the place where Processing’s extracted folder goes into.
  • My advise is to pick an unguarded non-system path, like “Documents”, to extract Processing into.