# Sketch path is not set

**URL:** <https://discourse.processing.org/t/sketch-path-is-not-set/2279>\
**Category:** Coding Questions\
**Created:** [August 1, 2018, 6:10pm UTC](https://discourse.processing.org/t/sketch-path-is-not-set/2279 "2018-08-01T18:10:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rfblock](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@Rfblock](https://discourse.processing.org/u/Rfblock)\
**Post date:** [August 1, 2018, 6:10pm UTC](https://discourse.processing.org/t/sketch-path-is-not-set/2279/1 "2018-08-01T18:10:13Z")

</div>

I’m using the Yahoo Weather Library

> [GitHub - delvedor/YahooWeatherProcessing: Yahoo Weather library for Processing](https://github.com/delvedor/YahooWeatherProcessing)  
> however I get an error whenever i try to create a weather object.  
> My code:

```auto
import processing.serial.*;

Serial dataPort;

String val;

//Settings
boolean use12Time = true; //24-Hour time or 12-Hour time
int slide = 1; //Starting slide
int totalSlides = 3; //# of slides total
int slideTime = 3; //Time on each slide (s)

//Timer
int savedTime;
int totalTime = slideTime * 1000;

//Yahoo weather
Weather weather = new Weather(23509325, "Celsius");

void setup() {
  size(200, 200);
  dataPort = new Serial(this, "COM5", 9600);
  savedTime = millis();
  while(weather.checkConnection() == false) {
    println("Refresh");
  }
}

void draw() {
  int passedTime = millis() - savedTime;
  if(passedTime > totalTime) {
    slide = (slide + 1) % totalSlides;
    savedTime = millis();
  }
  switch(slide) {
    case 1:
      if(use12Time) {
        if(hour() == 0) {
          dataPort.write("12:" + nf(minute(), 2) + " A" + '\n');
        } else if(1 <= hour() && hour() < 12) {
          dataPort.write(str(hour()) + ':' + nf(minute(), 2) + " A" + '\n');
        } else if(hour() == 12) {
          dataPort.write("12:" + str(minute()) + " P" + '\n');
        } else if(13 <= hour() && hour() < 24) {
          dataPort.write(str(hour() - 12) + ':' + nf(minute(), 2) + " P" + '\n');
        } else if(hour() == 24) {
          dataPort.write(str(hour()) + "12:" +nf(minute(), 2) + " A" + '\n');
        }
      } else {
        dataPort.write(str(hour()) + ':' + str(minute()) + '\n');
      }
    break;
    case 2:
      dataPort.write(str(month()) + '/' + str(day()) + '\n');
    break;
    case 3:
      
    break;
  }
}

```

The error:

```auto
The sketch path is not set.
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at processing.core.PApplet.runSketch(PApplet.java:10741)
	at processing.core.PApplet.main(PApplet.java:10511)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at processing.core.PApplet.runSketch(PApplet.java:10735)
	... 1 more
Caused by: java.lang.RuntimeException: Files must be loaded inside setup() or after it has been called.
	at processing.core.PApplet.createInputRaw(PApplet.java:7039)
	at processing.core.PApplet.createInput(PApplet.java:7011)
	at processing.core.PApplet.createReader(PApplet.java:6817)
	at processing.core.PApplet.loadXML(PApplet.java:5930)
	at processing.core.PApplet.loadXML(PApplet.java:5920)
	at ProcessingTextClock$Weather.<init>(ProcessingTextClock.java:114)
	at ProcessingTextClock.<init>(ProcessingTextClock.java:39)
	... 6 more

```

---

<div class="post-metadata">

**Author:** ![Rfblock](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@Rfblock](https://discourse.processing.org/u/Rfblock)\
**Post date:** [August 1, 2018, 7:04pm UTC](https://discourse.processing.org/t/sketch-path-is-not-set/2279/3 "2018-08-01T19:04:55Z")

</div>

I’m hoping that this works, however the library that I downloaded only has a .java file and a .pde file, so I can’t import the library with a .jar.

---

<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 1, 2018, 9:42pm UTC](https://discourse.processing.org/t/sketch-path-is-not-set/2279/4 "2018-08-01T21:42:18Z")

</div>

> [@Rfblock](#):
>
> aused by: java.lang.RuntimeException: Files must be loaded inside setup() or after it has been called.

I believe the above error message is realted to this line:

> [@Rfblock](#):
>
> Weather weather = new Weather(23509325, “Celsius”);

I suggest you check the example that comes with the library as it shows how to use it properly.

Related to your last post, where did you downloaded the files from? Just to clarify, you need to isntall the Yahoo weather library from the Contribution Manager in the PDE. Did you do that?

Kf

---

<div class="post-metadata">

**Author:** ![Rfblock](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@Rfblock](https://discourse.processing.org/u/Rfblock)\
**Post date:** [August 1, 2018, 10:11pm UTC](https://discourse.processing.org/t/sketch-path-is-not-set/2279/5 "2018-08-01T22:11:13Z")

</div>

Yup, I tried this and it worked, thanks!

---

<div class="post-metadata">

**Author:** ![acalleja](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@acalleja](https://discourse.processing.org/u/acalleja)\
**Post date:** [October 10, 2019, 4:15pm UTC](https://discourse.processing.org/t/sketch-path-is-not-set/2279/6 "2019-10-10T16:15:06Z")

</div>

I had a similar error… The issue is in the line:  
Weather weather = new Weather(23509325, “Celsius”);  
been before the “setup”. To avoid the error you should do the following:

[…]  
Weather weather;

void setup() {  
weather = new Weather(23509325, “Celsius”);  
[…]  
}

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [October 11, 2019, 4:49am UTC](https://discourse.processing.org/t/sketch-path-is-not-set/2279/7 "2019-10-11T04:49:04Z")

</div>

yes, do as suggested,

BUT  
do not use other peoples API code, use your own one.

also you should use the original yahoo api java example,  
the mentioned [GitHub - delvedor/YahooWeatherProcessing: Yahoo Weather library for Processing](https://github.com/delvedor/YahooWeatherProcessing) is from 2014.

but MOST: read  
[https://developer.yahoo.com/weather/](https://developer.yahoo.com/weather/)

> mportant EOL Notice: As of **Thursday, Jan. 3, 2019, the [weather.yahooapis.com](http://weather.yahooapis.com) and [query.yahooapis.com](http://query.yahooapis.com) for Yahoo Weather API will be retired.**
