Bugazelle/export-csv-to-influx

When run from subprocess call gives an 'UnboundLocalError'

Opened this issue · 0 comments

Hi.
I've been using version 0.1.25 script by calling it from within a python script as a 'subprocess.check_output("export_csv_to_influx....")' which parses through and collates a bunch of .dat files and then pushing those datapoints onto an InfluxDB1.8 server for several years now. All works really well! Thanks.
My issue now is that we've upgraded to InfluxDB2 and so have had to upgrade your script to the 0.2.2 version. If I run your script by itself then it works OK but when running from within my script it gives the 'UnboundLocalError: local variable 'headers' referenced before assignment' error, I renamed a variable I was using (also called 'headers') to 'heads' which I thought might be the problem but it still throws the same error.
My script IS a bit clunky, I'm wondering if there's a better way for me to call your module from within my script?
You mention your module can be run 'Programmatically' but I'm sorry I really don't understand the example you gave...
Can you please give me some direction on how to use your module from within a script so I don't have to call it with a subprocess.check_output, I believe it will work well for me then as it has done for many years on the old version.
Thank you for your script!