Skip to content

Commit

Permalink
conky module: add fallback delete parameter for py3.11 or less (#2275)
Browse files Browse the repository at this point in the history
  • Loading branch information
lasers authored Jan 21, 2025
1 parent f648cb6 commit 3d85b4c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions py3status/modules/conky.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,15 @@ def post_config_hook(self):
tmp = f"conky.config = {config}\nconky.text = [[{text}]]"

# write tmp output to '/tmp/py3status-conky_*', make a command
self.tmpfile = NamedTemporaryFile(
prefix="py3status_conky-", suffix=".conf", delete_on_close=False
)
try:
# python 3.12+
self.tmpfile = NamedTemporaryFile(
prefix="py3status_conky-", suffix=".conf", delete_on_close=False
)
except TypeError:
self.tmpfile = NamedTemporaryFile(
prefix="py3status_conky-", suffix=".conf", delete=False
)
self.tmpfile.write(str.encode(tmp))
self.tmpfile.close()
self.conky_command = f"conky -c {self.tmpfile.name}".split()
Expand Down

0 comments on commit 3d85b4c

Please sign in to comment.