Skip to content

Conversation

@BoboTiG
Copy link
Contributor

Hello,

This is a little patch for resource leaks such as:

$ python setup.py install setup.py:14: ResourceWarning: unclosed file <_io.TextIOWrapper name='README.rst' mode='r' encoding='UTF-8'> long_description=open("README.rst").read(), running install ...
$ bash examples/sample.sh scatterplot.py:100: ResourceWarning: unclosed file <_io.TextIOWrapper name='examples/data/texas.txt' mode='r' encoding='UTF-8'> plot_scatter(opts.f, opts.x, opts.y, opts.size, opts.pch, opts.colour, opts.t) with x and y coords scatterplot.py:57: ResourceWarning: unclosed file <_io.TextIOWrapper name='examples/data/x_test.txt' mode='r' encoding='UTF-8'> xs = [float(str(row).strip()) forrowin open(xs)] scatterplot.py:58: ResourceWarning: unclosed file <_io.TextIOWrapper name='examples/data/y_test.txt' mode='r' encoding='UTF-8'> ys = [float(str(row).strip()) forrowin open(ys)] histogram.py:109: ResourceWarning: unclosed file <_io.TextIOWrapper name='examples/data/exp.txt' mode='r' encoding='UTF-8'> f = open(f).readlines()

I also fixed this error:

Traceback (mostrecentcalllast): File".../bin/scatter", line11, in<module>load_entry_point('bashplotlib==0.6.5', 'console_scripts', 'scatter')() File"scatterplot.py", line100, inmainplot_scatter(opts.f, opts.x, opts.y, opts.size, opts.pch, opts.colour, opts.t) File"scatterplot.py", line74, inplot_scatterifcs: UnboundLocalError: localvariable'cs'referencedbeforeassignment

Signed-off-by: Mickaël Schoentgen [email protected]

@glampglamp merged commit 23319fe into glamp:masterJan 2, 2019
@BoboTiGBoboTiG deleted the fix-resource-leak branch January 2, 2019 18:19
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@BoboTiG@glamp