How dose filesystem service initialize?

When I use the “csv.from()”, it’s an error: error in csv.from(): csv.from() failed to read file: filesystem service is uninitialized.
How can I deal with it?

import “csv”

relativeToNow = (tables=<-) =>
tables
|> elapsed()
|> sort(columns: ["_time"], desc: true)
|> cumulativeSum(columns: [“elapsed”])
|> map(fn: (r) => ({ r with _time: time(v: int(v: now()) - (r.elapsed * 1000000000))}))

csv.from(file: “/home/ls/Influx_example/noaa.csv”, mode:“annotations”)
|> relativeToNow()
|> to(bucket: “noaa”, org: “x”)

Pit filling!
My boss said that I can’t use a browser to read a local file because of some security policy.
Perhaps I can use a kind of client library.
Or, if I can deal with the overtime problem, I can use the url way.

Hello @LuoS,
Are you using InfluxDB 2 Cloud? Or running OSS locally?
This works if you’re using the REPL.

This closed issue is related:

This blog might be helpful for learning about how to install the CLI locally and create a cloud configuration.

Thanks @Anaisdg
I‘m failed to build the REPL, so, I try to use python client.Maybe I can use python to read csv first.

Hello @LuoS,
What failed? Can you share any err messages? Sure try python if you prefer :slight_smile:

Reference: GitHub - influxdata/flux: Flux is a lightweight scripting language for querying databases (like InfluxDB) and working with data. It's part of InfluxDB 1.7 and 2.0, but can be run independently of those.

Codes:


$ sudo apt-get install -y clang pkg-config # No problem.

$ brew install pkg-config  # Not need.

$ go get github.com/influxdata/pkg-config 
# Error:can't connect to github.com.
# reason:need use VPN
#tests:1.I can't find a VPN software used in Ubuntu. 
#      2.I downloaded the file and cloned it to home/user/go/src/github.com/influxdata
#     (I forget how to installed Go, maybe this is the right path, but i can find another 'path /home/user/snap/go',there are only 3 empty folders )


$ export PATH=${GOPATH}/bin:${PATH}
# error: can't find the file.

$ which -a pkg-config
/home/user/go/bin/pkg-config
/usr/bin/pkg-config
#results:/usr/bin/pkg-config
#       /bin/pkg-config


$ go build ./cmd/flux
#error:go: go.mod file not found in current directory or any parent directory; see 'go help modules'
$ ./flux repl

Error conclusions:
1.can’t connect to github.com–could download the pkg-config folder manually
2.don’t know where the pkg-config folder shold be cloned to(where is the gopath?)
3.configuration failed