processing / processing/p5.js-web-editor

preload() hangs after altering .csv file

Open
#620 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.7k
Forks
1.7k
Avg merge
3d 4h
Merged PRs (30d)
8

Description

Nature of issue?
  • Found a bug
  • Existing feature enhancement
  • New feature request
Details about the bug:

My program is getting hung at preload(), evident by the fact that my sketch only shows "Loading..." now. It was working one minute and then the next, it can't get past "Loading...". I added 2 lines into the 1st .csv file, following the same format (commas between elements). In the preload(), I am using loadStrings() to load 2 csv files into a variable. The 1st file has 35 lines, and the 2nd has 7 lines, and each line is no longer than about 15 characters (so the .csv files are not big at all).

I found that renaming the 2 .csv files from 'Food.csv' -> 'food.csv' & 'Drink.csv' -> 'drink.csv' and updating the file names in preload() allowed the sketch to get past the hang in preload().

BUT, after editing the food.csv file (removing the 2 lines I added earlier), it hanged again in preload().

Solution:
This time I changed .csv to .txt files and the sketch works again (does NOT hang in preload()), and I can edit the .txt files without a problem.

EDIT:
After altering the 2nd .txt file, the program hangs again at preload()

2nd EDIT:
instead of loadStrings('food.txt'), I added a "/" to make it loadStrings('/food.txt') and it apparently doesn't hang???
loadStrings('food.txt') --> loadStrings('/food.txt')
loadStrings('drink.txt') --> loadStrings('/drink.txt')

So there seems to be a problem with the handling of a .csv file if it has been altered after initially being run in the sketch,
i.e. run a sketch where the .csv is inputted via loadStrings() in preload(), sketch runs without issue, stop the sketch, edit the .csv file, run the sketch, sketch hangs at preload()

  • Web browser and version: Google Chrome Version 65.0.3325.181
  • Operating System: Windows 10 Home, 64-bit

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported hang in preload() using loadStrings() with edited .csv and .txt files in Chrome on Windows 10. Compare the behavior of paths with and without a leading slash, and verify that edited files load without leaving the sketch on “Loading...”.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.