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

Exception when running plotter standalone with --use_gnuplot #151

Closed
csatt opened this issue Nov 20, 2020 · 0 comments
Closed

Exception when running plotter standalone with --use_gnuplot #151

csatt opened this issue Nov 20, 2020 · 0 comments
Assignees
Labels

Comments

@csatt
Copy link
Owner

csatt commented Nov 20, 2020

This bug is in code that isn't even used for IV Swinger 2. I hit it when running the following command from the CLI (needed to get full code coverage):

% ./IV_Swinger_plotter.py --use_gnuplot ~/Desktop/IV_Swinger2_old/Regression/IV_Swinger2/191116_13_03_12/iv_swinger2_191116_13_03_12.csv

This does not fail with the Python 2 code, but with Python 3 it gets the following exception:

Traceback (most recent call last):
File "./IV_Swinger_plotter.py", line 707, in
main()
File "./IV_Swinger_plotter.py", line 702, in main
ivp.run()
File "./IV_Swinger_plotter.py", line 693, in run
ivs_extended.plot_graphs(args, csv_proc)
File "./IV_Swinger_plotter.py", line 502, in plot_graphs
self.plot_with_plotter(gp_command_filename,
File "/Users/csatt/GitHub/IV_Swinger/python3/IV_Swinger.py", line 3234, in plot_with_plotter
self.plot_with_gnuplot(sd_gp_command_filename,
File "/Users/csatt/GitHub/IV_Swinger/python3/IV_Swinger.py", line 3250, in plot_with_gnuplot
self.write_gnuplot_file(sd_gp_command_filename,
File "/Users/csatt/GitHub/IV_Swinger/python3/IV_Swinger.py", line 3162, in write_gnuplot_file
self.adjust_margins()
File "/Users/csatt/GitHub/IV_Swinger/python3/IV_Swinger.py", line 4082, in adjust_margins
if self.plot_max_y < 0.5:
TypeError: '<' not supported between instances of 'NoneType' and 'float'

The problem is that the write_gnuplot_file() method in IV_Swinger.py calls the adjust_margins() method before the plot_max_y property is set by the set_y_range() method. This means plot_max_y has a value of None when the comparison with 0.5 is performed. In Python 2, this doesn't cause an exception because None is treated like 0.0 in the comparison. But Python 3 doesn't allow comparing None to a float.

The call to adjust_margins() needs to be moved after the call to set_y_range().

@csatt csatt added the bug label Nov 20, 2020
@csatt csatt self-assigned this Nov 20, 2020
csatt added a commit that referenced this issue Nov 20, 2020
This bug was "caught" by Python 3. See Issue #151.
@csatt csatt closed this as completed Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant