Error: config_file is not defined in send_storj_reports.py
After installing the latest version of Storj-Dashboard-Client, reports are no longer being sent due to the following error:
Sending report for node storj-farmer
{'server_uuid': '<redacted>', 'report_uuid': 'c9c747d7-acec-44e7-9f93-5a6923537a29', 'node_name': 'storj-farmer', 'current_size': 438974711883, 'node_capacity': 1000000000000.0, 'version': '0.3.8
', 'storj_node_id': '<redacted>'}
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/storjreports/send_storj_reports.py", line 114, in send_report
json_config = json.loads(regexed_config)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/usr/lib/python3.6/multiprocessing/pool.py", line 47, in starmapstar
return list(itertools.starmap(args[0], args[1]))
File "/usr/lib/python3.6/site-packages/storjreports/send_storj_reports.py", line 116, in send_report
print('Unable to decode JSON file: ' + config_file.name)
NameError: name 'config_file' is not defined
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/send_storj_reports", line 11, in <module>
load_entry_point('storjdash==0.3.8', 'console_scripts', 'send_storj_reports')()
File "/usr/lib/python3.6/site-packages/storjreports/__init__.py", line 5, in run_reports
send_storj_reports.main()
File "/usr/lib/python3.6/site-packages/storjreports/send_storj_reports.py", line 176, in main
examine_configs(settings['configs_directory'])
File "/usr/lib/python3.6/site-packages/storjreports/send_storj_reports.py", line 41, in examine_configs
results = pool.starmap(send_report, mp_args)
File "/usr/lib/python3.6/multiprocessing/pool.py", line 268, in starmap
return self._map_async(func, iterable, starmapstar, chunksize).get()
File "/usr/lib/python3.6/multiprocessing/pool.py", line 608, in get
raise self._value
NameError: name 'config_file' is not defined
I'm seeing something similar using version 0.3.9 and Ubuntu 17.04. Here is the output from send_storj_reports run from the terminal. It worked just after installation, but never updated after that and not it doesn't work manually either.
Traceback (most recent call last):
File "/usr/local/bin/send_storj_reports", line 11, in
load_entry_point('storjdash==0.3.9', 'console_scripts', 'send_storj_reports')()
File "/usr/local/lib/python3.5/dist-packages/storjreports/__init__.py", line 5, in run_reports
send_storj_reports.main()
File "/usr/local/lib/python3.5/dist-packages/storjreports/send_storj_reports.py", line 184, in main
examine_configs(settings['configs_directory'])
File "/usr/local/lib/python3.5/dist-packages/storjreports/send_storj_reports.py", line 27, in examine_configs
storj_node_pairs = examine_storjstatus()
File "/usr/local/lib/python3.5/dist-packages/storjreports/send_storj_reports.py", line 73, in examine_storjstatus
proc = subprocess.Popen(['storjshare', 'status'], env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/usr/lib/python3.5/subprocess.py", line 676, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1282, in _execute_child
raise child_exception_type(errno_num, err_msg)
NotADirectoryError: [Errno 20] Not a directory
This behavior is consistent between multiple computers.
I figured out my problem and it may be different than the one I replied to originally. The problem was that the local $PATH needed to permanently include /opt/storjshare and not just sudoers. I had done it at the terminal originally and must have rebooted after the first update so it was lost. Adding PATH="$PATH:/opt/storjshare" to ~/.profile works.
source ~/.profile needs to be run to update the path after the changes without logging out and back in.