Skip to content

Conversation

@pietrodn
Copy link
Contributor

@pietrodn pietrodn commented Aug 25, 2018

If a program using ola.ClientWrapper is run with python -Wall on Python 3, the interpreter prints a ResourceWarning complaining about an unclosed socket.
This PR fixes that warning.

For example, if you run:

cd python
python3 -Wall examples/ola_send_dmx.py

You will get:

examples/ola_send_dmx.py:56: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
  client.SendDmx(universe, data, DmxSent)
Success!
sys:1: ResourceWarning: unclosed <socket.socket fd=5, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 52925), raddr=('127.0.0.1', 9010)>

With the proposed fix, the ResourceWarning disappears.

Copy link
Member

@peternewman peternewman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pietrodn !

@peternewman peternewman added this to the 0.11.0 milestone Sep 6, 2018
@peternewman
Copy link
Member

Would you mind retargetting this PR at our 0.10 branch please.

@pietrodn pietrodn changed the base branch from master to 0.10 September 6, 2018 22:32
@pietrodn pietrodn changed the base branch from 0.10 to master September 6, 2018 22:33
@pietrodn pietrodn changed the base branch from master to 0.10 September 6, 2018 22:37
@pietrodn
Copy link
Contributor Author

pietrodn commented Sep 6, 2018

I cherry-picked my commit and added it on top of the 0.10 branch. Everything should be ok.

@peternewman peternewman modified the milestones: 0.11.0, 0.10.8 Sep 7, 2018
@peternewman peternewman merged commit 9a165e3 into OpenLightingProject:0.10 Sep 7, 2018
@pietrodn pietrodn deleted the close-socket branch September 7, 2018 18:08
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

Successfully merging this pull request may close these issues.

2 participants