Skip to content

Commit b37fab8

Browse files
authored
Merge pull request #1304 from imapersonman/stderr-redir-fix
Stderr redir fix
2 parents 92720a4 + bde041e commit b37fab8

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

interpreter/core/utils/telemetry.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,20 @@ def get_or_create_uuid():
4545

4646

4747
def send_telemetry(event_name, properties=None):
48+
if properties is None:
49+
properties = {}
50+
properties["oi_version"] = pkg_resources.get_distribution(
51+
"open-interpreter"
52+
).version
4853
try:
49-
if properties is None:
50-
properties = {}
51-
properties["oi_version"] = pkg_resources.get_distribution(
52-
"open-interpreter"
53-
).version
54-
with open(os.devnull, "w") as f, contextlib.redirect_stdout(
55-
f
56-
), contextlib.redirect_stderr(f):
57-
url = "https://app.posthog.com/capture"
58-
headers = {"Content-Type": "application/json"}
59-
data = {
60-
"api_key": "phc_6cmXy4MEbLfNGezqGjuUTY8abLu0sAwtGzZFpQW97lc",
61-
"event": event_name,
62-
"properties": properties,
63-
"distinct_id": user_id,
64-
}
65-
response = requests.post(url, headers=headers, data=json.dumps(data))
54+
url = "https://app.posthog.com/capture"
55+
headers = {"Content-Type": "application/json"}
56+
data = {
57+
"api_key": "phc_6cmXy4MEbLfNGezqGjuUTY8abLu0sAwtGzZFpQW97lc",
58+
"event": event_name,
59+
"properties": properties,
60+
"distinct_id": user_id,
61+
}
62+
requests.post(url, headers=headers, data=json.dumps(data))
6663
except:
67-
# Non blocking
6864
pass

0 commit comments

Comments
 (0)