Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is an error in operation. I would like to ask you for help. #241

Open
AceWang377 opened this issue Oct 17, 2023 · 3 comments
Open

Comments

@AceWang377
Copy link

Hello, thank you for providing such an excellent project and code. I don’t understand something and would like to ask you for advice. After configuring the api, I ran the command tracarbon run in the terminal but an error was displayed. I would like to ask you for advice on which one should be run. Does the program or what other parts of the program need to be changed before it can run?
error:
ValueError: could not convert string to float: ''

@fvaleye
Copy link
Owner

fvaleye commented Oct 18, 2023

Hello @AceWang377 👋,

Thank you for your message!

Sure, I can help you with that. However, I'll need some more information to provide a detailed answer:

  1. The version of Tracarbon
  2. The full stack trace, I would need to see the error message you're receiving. If you're running a command or a script that results in an error, please provide the entire output.
  3. Regarding the hardware, could you please specify what information you're interested in? Are you asking about the server specifications (like CPU, RAM, etc.) or something else?
  4. As for where it's running, are you asking about the physical location of the server or the type of environment (like production, staging, etc.)?

If you could provide these details, I'd be able to assist you better.

@AceWang377
Copy link
Author

Thank you very much for replying to my message. I'm just learning this stuff so I'm sorry I have some very basic questions for you. My computer is the MacBook M1 version, and yesterday I entered the variable environment TRACARBON_CO2SIGNAL_API_KEY=", then pip installed some necessary packages, and downloaded the software Developer Portal by Blobr. Then run all the code in your code package. py file is also not an error. But when I finally ran tracarbon run in the terminal, an error occurred:
(pythonProject) wangzixuandemacbook@wangzixuandeMACBOOKdeMacBook-Air pythonProject % tracarbon run
2023-10-18 14:36:15.136 | INFO Tracarbon CLI started.
Traceback (most recent call last):

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/bin/tracarbon", line 8, in
sys.exit(main())

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/site-packages/tracarbon/cli/init.py", line 146, in main
app()

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/site-packages/tracarbon/cli/init.py", line 138, in run
run_metrics(

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/site-packages/tracarbon/cli/init.py", line 121, in run_metrics
with tracarbon:

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/site-packages/tracarbon/builder.py", line 48, in enter
self.start()

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/site-packages/tracarbon/builder.py", line 58, in start
self.exporter.start(interval_in_seconds=self.configuration.interval_in_seconds)

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/site-packages/tracarbon/exporters/exporter.py", line 136, in start
_run()

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/site-packages/tracarbon/exporters/exporter.py", line 129, in _run
asyncio.run(self._launch_all())

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/site-packages/tracarbon/exporters/exporter.py", line 154, in _launch_all
await self.launch(metric_generator=metric_generator)

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/site-packages/tracarbon/exporters/stdout.py", line 17, in launch
async for metric in metric_generator.generate():

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/site-packages/tracarbon/general_metrics.py", line 30, in generate
energy_usage = await self.energy_consumption.get_energy_usage()

File "/Users/wangzixuandemacbook/.conda/envs/pythonProject/lib/python3.10/site-packages/tracarbon/hardwares/sensors.py", line 95, in get_energy_usage
return EnergyUsage(host_energy_usage=float(result))

ValueError: could not convert string to float: ''

1.Tracarbon version is 0.7.1
2. The error is as shown above
3/4. Please forgive my ignorance. I want to use this carbon footprint software to record the carbon emission index generated by my daily behaviour, and use this to check the carbon emission level in my area. Then after downloading the DEVERLOP software, I can directly use the map to see the average carbon emission level in my area, but I don't know if it can also record my carbon footprint.

Thank you again for taking the time to answer my question, and I look forward to hearing from you.

@fvaleye
Copy link
Owner

fvaleye commented Oct 19, 2023

Thank you @AceWang377!
Could you please run this command in a terminal on your laptop:
/usr/sbin/ioreg -rw0 -c AppleSmartBattery
And send me the full output in text with the command used.

If the output is too big:
/usr/sbin/ioreg -rw0 -c AppleSmartBattery | grep BatteryData | grep -o '"AdapterPower"=[0-9]*'

I will take a look on why it fails on your Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants