# Sketch not working after upgrade to High Sierra

**URL:** https://discourse.processing.org/t/sketch-not-working-after-upgrade-to-high-sierra/2425
**Category:** Coding Questions
**Created:** [August 6, 2018, 8:49pm UTC](https://discourse.processing.org/t/sketch-not-working-after-upgrade-to-high-sierra/2425 "2018-08-06T20:49:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![egorozpe](https://avatars.discourse-cdn.com/v4/letter/e/ecc23a/32.png) [@egorozpe](https://discourse.processing.org/u/egorozpe)
#### Post date: [August 6, 2018, 8:49pm UTC](https://discourse.processing.org/t/sketch-not-working-after-upgrade-to-high-sierra/2425/1 "2018-08-06T20:49:50Z")

</div>

I have a sketch that I use for mapping urban space, which shows in the background some photos named C\_0001, C\_0002, and so on. It is setup to show the images in the normal order (1,2,3,4 etc.) It was working just fine until I upgraded my mac to High Sierra. Now the sketch is showing them in a random sequence. (C\_039, C\_123, C\_004, etc) Can anybody help me with this issue?

---

<div class="post-metadata">

### Author: ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)
#### Post date: [August 6, 2018, 9:05pm UTC](https://discourse.processing.org/t/sketch-not-working-after-upgrade-to-high-sierra/2425/2 "2018-08-06T21:05:20Z")

</div>

So it is true you didn’t change the code at all?

Is this code self-contained or is it interacting with other software or even accessing resources wireless? (synchronization issues)

It is hard to imagine an upgrade like this could create the effect you are describing. I have been proving wrong before. You can use the debugger to track the problem. Or you can share relevant code or it is better if you can provide a minimal running example demonstrating the problem.

Kf

---

<div class="post-metadata">

### Author: ![egorozpe](https://avatars.discourse-cdn.com/v4/letter/e/ecc23a/32.png) [@egorozpe](https://discourse.processing.org/u/egorozpe)
#### Post date: [August 6, 2018, 9:08pm UTC](https://discourse.processing.org/t/sketch-not-working-after-upgrade-to-high-sierra/2425/3 "2018-08-06T21:08:23Z")

</div>

No change at all, I can asure that. It is self contained it reaches some images and data .csv files from a folder located in the same main folder.

![48%20PM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8807b433c6ee28ae82e7ba4c97270cf57f38d0af.png)

Here is the code:

//DATA GATHERING MKIV  
//Sketch by Eduardo Gorozpe & Cesar Saldivar  
//180327

//------------------------------  
//INSTRUCTIONS  
//Mind the data format! (C\_####.JPG)  
//NEVER delete or change the folder tree within the sketch’s folder… NEVER  
//Use RIGHT and LEFT arrows to navigate through images  
//Use MOUSE WHEEL or type ‘+’ or ‘-’ to zoom in or out respectively  
//Use LEFT mouse button to add person  
//Use RIGHT mouse button to remove person  
//Type ‘A’ or ‘a’ to assign “Romance” activity  
//Type ‘B’ or ‘b’ to assign “Bicicleta o patinar” activity  
//Type ‘C’ or ‘c’ to assign “Comer” activity  
//Type ‘D’ or ‘d’ to assign “Documentar” activity  
//Type ‘E’ or ‘e’ to assign “Estancia” activity  
//Type ‘J’ or ‘j’ to assign “Jugar” activity  
//Type ‘L’ or ‘l’ to assign “Leer” activity  
//Type ‘P’ or ‘p’ to assign “Platicar” activity  
//Type ‘R’ or ‘r’ to assign “Reunirse” activity  
//Type ‘T’ or ‘t’ to assign “Transitar” activity  
//Type ‘V’ or ‘v’ to assign “Vender” activity  
//Tyoe ‘0’ to return to first frame

//WORKFLOW:  
//[0] Configure inferface: Define canvas and camera attributes. Adjust dataG\_focalLengthTolerance.  
//[1] Run sketch  
//[2] Add new person name (If required). Mind the format! (Genre\_Age\_number)  
//[3] For Genre: H stands for men, M stands for women. For Age: N stands for child, J stands for youngster, A stands for adult and M stands for elderly.  
//[4] Select current person from dropdown  
//[5] Add new group name (If required).  
//[6] Select current group from dropdown  
//[7] Set coordinate using mouse LEFT button  
//[8] Type the corresponding activity  
//[9] If activity omitted (By clicking again), activity will be set blank  
//[10] If corrections needed, select the person to correct from dropdown and repeat steps [7] through [9]  
//[11] To delete a person, RIGHT click on it  
//[12] Click on the “SAVE DATA” button to save all the info in their corresponding csv files

//------------------------------  
//LIBRARIES  
import java.io.File;  
import controlP5.\*;

//------------------------------  
//CONTROL PANEL  
//Canvas  
int dataG\_screenWidth = 1244;  
int dataG\_screenHeight = 700;

//Camera  
float dataG\_focalLengthTolerance = 14.00; //Factor de corrección de perspectiva  
float dataG\_xSizeMultiplier = 1.325; //Correccion de margen de error en X  
float dataG\_ySizeMultiplier = 1.245; //Correccion de margen de error en Y  
float dataG\_distanceToFocalCentre = 35.00;  
float dataG\_cameraHeight = 56.00;  
float dataG\_cameraFocalLength = 35.00+dataG\_focalLengthTolerance;  
float dataG\_sensorSizeX = 22.40;  
float dataG\_sensorSizeY = 15.00;

//Pics  
String dataG\_folderLocation = “/Users/egorozpe/Desktop/sketch\_180327\_EG\_dataG\_MKIV”;  
File dataG\_imgsLocation = new File(dataG\_folderLocation+"/sitePics");  
File[] dataG\_images = dataG\_imgsLocation.listFiles();  
int dataG\_fontSize = 14;  
color dataG\_imgLabelColour = color(0, 0, 0);

//GUI vars  
float dataG\_peopleStrokeWeight = 10;  
int dataG\_infoFontSize = 12;  
String dataG\_currentPerson = “Default”, dataG\_currentGroup = “Default”;

//Data  
File dataG\_dataLocation = new File(dataG\_folderLocation+"/data/porPersona");  
File dataG\_dataFrameLocation = new File(dataG\_folderLocation+"/data/porCuadro");  
File dataG\_dataGenderLocation = new File(dataG\_folderLocation+"/data/porGenero");  
File dataG\_dataGroupLocation = new File(dataG\_folderLocation+"/data/porGrupo");  
File[] dataG\_data = dataG\_dataLocation.listFiles();  
File[] dataG\_groupData = dataG\_dataGroupLocation.listFiles();

//------------------------------  
//GLOBAL VARIABLES  
//Pics  
PImage dataG\_currentImg;  
PFont dataG\_font;  
int dataG\_navCounter = 0;  
int dataG\_imgIndex = 0;  
String[] dataG\_dataList = dataG\_imgsLocation.list();

//GUI  
ControlP5 dataG\_cp5;  
Accordion dataG\_acc;  
ControlGroup dataG\_ctrl;  
//Controllers  
Slider dataG\_peopleStrokeWeight\_Slider;  
Slider dataG\_infoFontSize\_Slider;  
Textfield dataG\_newPerson\_Textfield;  
Bang dataG\_addPerson\_Bang;  
ScrollableList dataG\_people\_ScrollabeList;  
Textfield dataG\_newGroup\_Textfield;  
Bang dataG\_addGroup\_Bang;  
ScrollableList dataG\_peopleGroups\_ScrollabeList;  
Button dataG\_saveData\_Button;  
//Positions  
int dataG\_cp5Len = 200;  
int dataG\_yStep = 15;  
float currentPosA, currentPosB, currentPosC, currentPosD;

//Interaction vars  
float dataG\_zoom = 1.00;  
ArrayList dataG\_people = new ArrayList();  
ArrayList dataG\_peopleGroups = new ArrayList();  
ArrayList\<float[]\> dataG\_personX = new ArrayList\<float[]\>();  
ArrayList\<float[]\> dataG\_personY = new ArrayList\<float[]\>();  
ArrayList\<String[]\> dataG\_personGroup = new ArrayList\<String[]\>();  
ArrayList\<String[]\> dataG\_personActivity = new ArrayList\<String[]\>();  
int dataG\_currentPersonIndex, dataG\_currentGroupIndex;  
boolean dataG\_addData = false, dataG\_removeData = false;  
int dataG\_addDataCounter = 0;  
int dataG\_saveDataCounter = 0;  
float dataG\_activeAlpha = 0.0;

//dataG\_PointPerson  
ArrayList dataG\_myPeople = new ArrayList();

//------------------------------  
//MAIN  
//settings()  
void settings() {  
size(dataG\_screenWidth, dataG\_screenHeight);  
smooth();  
}

//------------------------------  
//setup()  
void setup() {  
//Create font  
dataG\_font = createFont(dataG\_folderLocation+"/fonts/arial.ttf", dataG\_fontSize);

//Initialise GUI  
dataG\_initialiseLists();  
dataG\_setupGUI();  
}

//------------------------------  
//draw()  
void draw() {  
//Cursor display  
if (!dataG\_cp5.isMouseOver()) cursor(CROSS);  
else cursor(ARROW);

//Update people  
dataG\_updatePeople();

//Display, zoom and pan bg img  
pushMatrix();  
dataG\_zoomAndPan();  
dataG\_imgDisplay();

//Display people  
dataG\_displayPeopleInfo();  
dataG\_displayTrails();  
dataG\_displayPeople();

popMatrix();

//Display img label  
dataG\_imgLabelDisplay();

//Run GUI  
dataG\_runGUI();

//Save data  
dataG\_writeCsvs();

//Global counters  
dataG\_addDataCounter++;  
dataG\_saveDataCounter++;  
}

//------------------------------  
//keyPressed()  
void keyPressed() {  
if (key== CODED) {  
if (keyCode == RIGHT && !dataG\_newPerson\_Textfield.isActive()) {  
dataG\_imgIndex++;  
dataG\_navCounter = 0;  
}  
if ( keyCode == LEFT && !dataG\_newPerson\_Textfield.isActive()) {  
dataG\_imgIndex–;  
dataG\_navCounter = 0;  
}  
}

//Zoom  
if (key==’+’) dataG\_zoom+=.5;  
if (key==’-’) dataG\_zoom-=.5;

//Assign activitys  
//Transitar  
if ((key==‘t’ || key==‘T’) &&!dataG\_newPerson\_Textfield.isActive() && dataG\_addData) {  
String[] tempActivity = dataG\_personActivity.get(dataG\_currentPersonIndex);  
tempActivity[dataG\_imgIndex] = “Transitar”;  
dataG\_addData = false;  
}

//Dirigir  
if ((key==‘d’ || key==‘D’) &&!dataG\_newPerson\_Textfield.isActive() && dataG\_addData) {  
String[] tempActivity = dataG\_personActivity.get(dataG\_currentPersonIndex);  
tempActivity[dataG\_imgIndex] = “Dirigir”;  
dataG\_addData = false;  
}

//Esperar  
if ((key==‘e’ || key==‘E’) &&!dataG\_newPerson\_Textfield.isActive() && dataG\_addData) {  
String[] tempActivity = dataG\_personActivity.get(dataG\_currentPersonIndex);  
tempActivity[dataG\_imgIndex] = “Esperar”;  
dataG\_addData = false;  
}

//Return to first frame  
if (key==‘0’) dataG\_imgIndex = 0;  
}

//------------------------------  
//mousePressed()  
void mousePressed() {  
if (mouseButton == LEFT && !dataG\_cp5.isMouseOver()) {  
if (dataG\_addData) {  
String[] tempActivity = dataG\_personActivity.get(dataG\_currentPersonIndex);  
tempActivity[dataG\_imgIndex] = “”;  
}  
dataG\_addData = !dataG\_addData;  
dataG\_removeData = false;  
dataG\_addDataCounter = 0;  
}  
if (mouseButton == RIGHT && !dataG\_cp5.isMouseOver()) {  
dataG\_removeData = !dataG\_removeData;  
dataG\_addData = false;  
}  
if (mouseButton == LEFT && dataG\_cp5.isMouseOver()) dataG\_saveDataCounter = 0;  
}

void mouseWheel(MouseEvent activity) {  
if (!dataG\_cp5.isMouseOver()) {  
float z = activity.getCount();  
z \*= -.5;  
dataG\_zoom+=z;  
}  
}

---

<div class="post-metadata">

### Author: ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)
#### Post date: [August 7, 2018, 6:38am UTC](https://discourse.processing.org/t/sketch-not-working-after-upgrade-to-high-sierra/2425/4 "2018-08-07T06:38:47Z")

</div>

> The `listFiles` method, with or without a filter does not guarantee any order.

You could use `.sort()` to sort the files:

> <https://stackoverflow.com/questions/7199911/how-to-file-listfiles-in-alphabetical-order>

Without sort, maybe it was working right by chance, but after the OS update, the it’s no longer the case.
