You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to send messages to my TAK server (taky in a local environment), I see the following deprecation warning exception being thrown during the generation of the hello event cot message: python3.12/site-packages/pytak/functions.py", line 233, in gen_cot\n b"\\n".join([pytak.DEFAULT_XML_DECLARATION, ET.tostring(cot)]) if cot else None\n ^^^\nDeprecationWarning: Testing an element\'s truth value will raise an exception in future versions. Use specific \'len(elem)\' or \'elem is not None\' test instead.'} {'error': "Testing an element's truth value will raise an exception in future versions. Use specific 'len(elem)' or 'elem is not None' test instead."
In my local environment, I was able to resolve this by doing the following (this could definitely be cleaner):
diff --git a/pytak/functions.py b/pytak/functions.py
index 9b98a91..fdd9e5c 100644
--- a/pytak/functions.py+++ b/pytak/functions.py@@ -221,10 +221,13 @@ def gen_cot(
) -> Optional[bytes]:
"""Generate a minimum CoT Event as an XML string [gen_cot_xml() wrapper]."""
cot: Optional[ET.Element] = gen_cot_xml(lat, lon, ce, hae, le, uid, stale, cot_type)
- return (- b"\n".join([pytak.DEFAULT_XML_DECLARATION, ET.tostring(cot)]) if cot else None- )+ if cot is not None:+ cot = b"\n".join([pytak.DEFAULT_XML_DECLARATION, ET.tostring(cot)])+ return cot
Environment Details:
Python version : 3.12
Pytak version: 7.0.1
Python version manager: pyenv
The text was updated successfully, but these errors were encountered:
When I try to send messages to my TAK server (taky in a local environment), I see the following deprecation warning exception being thrown during the generation of the hello event cot message:
python3.12/site-packages/pytak/functions.py", line 233, in gen_cot\n b"\\n".join([pytak.DEFAULT_XML_DECLARATION, ET.tostring(cot)]) if cot else None\n ^^^\nDeprecationWarning: Testing an element\'s truth value will raise an exception in future versions. Use specific \'len(elem)\' or \'elem is not None\' test instead.'} {'error': "Testing an element's truth value will raise an exception in future versions. Use specific 'len(elem)' or 'elem is not None' test instead."
In my local environment, I was able to resolve this by doing the following (this could definitely be cleaner):
Environment Details:
Python version : 3.12
Pytak version: 7.0.1
Python version manager: pyenv
The text was updated successfully, but these errors were encountered: