fix: f-string expression part cannot include a backslash#18
Conversation
f-string and string concat is redundant and `\n` causes issues on older versions of python (I'm getting this on Python 3.13.5).
```
Traceback (most recent call last):
File "/root/.local/bin/chnvml", line 3, in <module>
from caioh_nvml_gpu_control.__main__ import script_call
File "/root/.local/pipx/venvs/caioh-nvml-gpu-control/lib/python3.11/site-packages/caioh_nvml_gpu_control/__main__.py", line 9, in <module>
import nvml_gpu_control
File "/root/.local/pipx/venvs/caioh-nvml-gpu-control/lib/python3.11/site-packages/caioh_nvml_gpu_control/nvml_gpu_control.py", line 3, in <module>
import helper_functions as main_funcs
File "/root/.local/pipx/venvs/caioh-nvml-gpu-control/lib/python3.11/site-packages/caioh_nvml_gpu_control/helper_functions.py", line 261
log_helper(f'{"\n" + "\n".join(log_msg) + "\n"}')
^
SyntaxError: f-string expression part cannot include a backslash
```
|
I would like to start by saying that I appreciate when someone takes a look at the code and I like it even more when they already provide the fixes for the problems. So, huge thanks! The fix is rather simple and I will accept it, but first I will test it locally to see if nothing breaks unexpectedly. It also makes the code more readable (I don't know I made the code like that to be honest with you).
Well, that is interesting. I have just checked my python version (just to see why I didn't get the error) and I am actually using an older version of python ( To finish, thanks for contributing! |
|
It took me a while to be able to stop and test the code, but I finally got the time. The code did not break anything and was merged into the main branch. I will do some other small updates and release a new version on Pypi. Once again, thanks for the contribution! |
f-string and string concat is redundant and
\ncauses issues on older versions of python (I'm getting this on Python 3.13.5).