[josm-dev] How to use DownloadTask in Python/Jython

Paul Hartmann phaaurlt at gmail.com
Fri Jan 16 14:00:26 UTC 2015


On 16.01.2015 14:23, Jo wrote:
> Hi guys,
>
> Unfortunately I'm not smart enough to code in Java, so I use Python in the
> scripting plugin, which gets me quite far, but now I'm stuck:
>
> [...]
>
>          dt = DownloadOsmTask()
>          dt.loadUrl(False, 'http://overpass-api.de/api/interpreter?data=' +
> overpassQuery, None)
>          dt.realRun()
>

loadUrl returns a Future object. You can call the get() method on that 
object, to wait for the download to finish (it is done in a background 
thread):

   f = dt.loadUrl(...)
   f.get()

Also you don't call dt.realRun() directly, the method loadUrl should 
already do this.

Paul




More information about the josm-dev mailing list