# My enemy "Script error. (:line 0)"

**URL:** <https://discourse.processing.org/t/my-enemy-script-error-line-0/19372>\
**Category:** p5.js\
**Created:** [April 3, 2020, 8:03pm UTC](https://discourse.processing.org/t/my-enemy-script-error-line-0/19372 "2020-04-03T20:03:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adelta\_21](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@Adelta\_21](https://discourse.processing.org/u/Adelta_21)\
**Post date:** [April 3, 2020, 8:03pm UTC](https://discourse.processing.org/t/my-enemy-script-error-line-0/19372/1 "2020-04-03T20:03:09Z")

</div>

Hello girls and guys,  
Since i started using the P5js web editor to introduce myself to imperative programming in javascript, I’ve often stumbled upon the following problem:  
p5.js doesn’t give any information whatsoever about the **nature of an error** or it’s **location** if it’s **during the execution**.

Since I started making bigger and bigger programs, I’ve come to fear this well known enemy of mine: “Script error. (:line 0)”

I mean what a wonder to know that there is an error somewhere in a 500 lines long program… like finding a needle (that looks like hay) in a haystack.

I’ve come to rewrite entire programs from scratch because I was unable to find the source of an error, and that is quite unsatisfying.

Now that I started coding in C++ with Xcode (which btw is an amazing IDE), getting back to p5.js is not fun at all.  
Anyway, I’m getting lost in my thoughts…

So, in my frustration, I’m calling for help to the community.  
**Do you have the same problem ?**  
**Is it due to some navigator settings ?**  
(Safari version 10.1.2 (11605.3.8.1) and MacOs El Capitan 10.11.6)  
**Should I accept my fate ?**

I could have just pasted my entire program here, but to be honest, it’s really not a well documented program and even I struggle to understand it sometimes.  
However, if you’re interested in a biologicaly realistic ant-simulator, you’ve come to the right person.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [April 4, 2020, 8:43pm UTC](https://discourse.processing.org/t/my-enemy-script-error-line-0/19372/2 "2020-04-04T20:43:41Z")

</div>

> [@Adelta\_21](#):
>
> Do you have the same problem?

B/c I don’t use the p5js online editor I don’t!

> [@Adelta\_21](#):
>
> Is it due to some navigator settings?

I can’t say for sure either.

What I do know is that most JS online hosts run our code inside an [`<iframe>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe), which by itself gets a little in the way when we need to debug it.

But by itself an [`<iframe>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe) shouldn’t interfere that much.

It would only make it harder to directly access global variables and that’s it.

My guess is that the p5js online editor goes further than that, w/ “features” like console logs redirection, “friendly” custom error messages and so on; which end up interfering w/ normal console debugging!

> [@Adelta\_21](#):
>
> Should I accept my fate?

Having so many other options available in the JS world, I fail to understand why you would feel like so!

For most cases, where my sketches are small, I just use a simple text editor like Notepad2; and Atom for bigger 1s:

> [@Web editor -- offline?](https://discourse.processing.org/t/web-editor-offline/12399/7):
>
> Most of the time, I just use a simple text editor like Notepad2 to write JS code and host them online at [OpenProcessing.org](http://OpenProcessing.org) or as a GitHub gist: For more complex stuff, like writing TS or CS code, I use the Atom IDE and host them as a GitHub repo:

Once I’ve got them running properly I pick some JS host site:

> [@Help! Why I cannot use the P5JS](https://discourse.processing.org/t/help-why-i-cannot-use-the-p5js/18067/2):
>
> For an absolute beginner, my advice is to start on some p5js online editor, such as this 1: man_student[OpenProcessing.org/sketch/create](http://OpenProcessing.org/sketch/create) Some sketches I’ve got there btW: grinning By using such specialized p5js online resources we don’t need to make our own “index.html” file. wink When you decide it’s time to learn how to code your own “index.html” file, you can use more generic JS online editors, such as these 2 below: sunglasses You can also take a look at my sketches I…

---

<div class="post-metadata">

**Author:** ![Adelta\_21](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@Adelta\_21](https://discourse.processing.org/u/Adelta_21)\
**Post date:** [April 6, 2020, 9:39am UTC](https://discourse.processing.org/t/my-enemy-script-error-line-0/19372/3 "2020-04-06T09:39:11Z")

</div>

Thank you for enlightening me on this matter.  
It seems now that the p5.js web editor I used was good and fun for a starter.  
Moving onto a “local” IDE like Atom is the right move.  
I didn’t know about OpenProcessing, and it is very very helpful.  
Thank you again for your advice.  
I’m so much back in the mood for JS programming.  
It’s gonna be amazing.

---

<div class="post-metadata">

**Author:** ![slow\_izzm](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/slow_izzm/32/5637_2.png) [@slow\_izzm](https://discourse.processing.org/u/slow_izzm)\
**Post date:** [April 6, 2020, 7:40pm UTC](https://discourse.processing.org/t/my-enemy-script-error-line-0/19372/4 "2020-04-06T19:40:43Z")

</div>

I thinks its related to the p5.accessibility lib.

go to Settings \>\> Accessibility

… are any of the boxes checked under “Accessible text-based canvas”?

---

<div class="post-metadata">

**Author:** ![Adelta\_21](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@Adelta\_21](https://discourse.processing.org/u/Adelta_21)\
**Post date:** [April 7, 2020, 8:21am UTC](https://discourse.processing.org/t/my-enemy-script-error-line-0/19372/5 "2020-04-07T08:21:36Z")

</div>

None of the boxes you’re referring to are checked.  
I tried checking “Plain text” and it did change something.  
The error message is now much more informative.  
Thank you for that.
