Board index FlightGear Development Nasal

Nasal IO - no such file or directory.

Nasal is the scripting language of FlightGear.

Nasal IO - no such file or directory.

Postby legoboyvdlp » Thu Jan 17, 2019 4:10 pm

Hi,
I'm trying to use Nasal IO for a side project:

Code: Select all
var cyclePath = getprop("/sim/fg-home") ~ "/Export/AloftWx/cycle-2018121906.grib2";
   var cycleFile = io.open(cyclePath, "wb+"); # open in write mode
http.load("http://www.ftp.ncep.noaa.gov/data/nccf/com/gfs/prod/gfs.2018121906/WAFS_blended_2018121906f06.grib2").done(func(r) io.write(cycleFile, r.response));
   io.close(cycleFile);


In this case, I get "No such file or directory". Isn't io.open(file, "wb+"); meant to open it in write mode? How can I create a new file?
User avatar
legoboyvdlp
 
Posts: 6139
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: Nasal IO - no such file or directory.

Postby wkitty42 » Thu Jan 17, 2019 5:55 pm

does that "AloftWx" directory exist? if no, you need to create it before attempting to create the file... unless there's an existing call i don't know about (very likely) that will create the full path for you as well as the file...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 4956
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5


Return to Nasal

Who is online

Users browsing this forum: Google [Bot] and 2 guests