Closed tyhdefu closed 4 months ago
ResourceWarning: unclosed file <_io.TextIOWrapper name='test_out\\extra\\Scenario3.5\\plx_253114.drawio' mode='w' encoding='utf-8'>
This appears to be due to you missing brackets: file.close vs file.close() https://github.com/MerrimanInd/drawpyo/blob/ec35335391178ee96fa5f96e2d4d782ed62dbf26/src/drawpyo/file.py#L139
file.close
file.close()
It might also be a good opportunity to instead use with, which automatically closes the file for you.
with
with open(path.join(self.file_path, self.file_name), write_mode, encoding="utf-8") as f: f.write(self.xml)
Thank you for this great library - it has been hugely helpful.
Thanks for this catch! A little embarassed that slipped through the cracks. But I should be able to get a fix out this weekend.
Merged the PR, it'll be in the next release!
This fix is in version 0.2, thanks!
ResourceWarning: unclosed file <_io.TextIOWrapper name='test_out\\extra\\Scenario3.5\\plx_253114.drawio' mode='w' encoding='utf-8'>
This appears to be due to you missing brackets:
file.close
vsfile.close()
https://github.com/MerrimanInd/drawpyo/blob/ec35335391178ee96fa5f96e2d4d782ed62dbf26/src/drawpyo/file.py#L139It might also be a good opportunity to instead use
with
, which automatically closes the file for you.Thank you for this great library - it has been hugely helpful.