Skip to content

Commit

Permalink
fix: warning if /tmp directory not found for memory_tempfile. Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
YodaEmbedding committed Oct 13, 2023
1 parent abfebca commit d4bf844
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/utils/point_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import os
import re
import subprocess
import tempfile
import traceback
import warnings
from typing import Optional

import numpy as np
Expand All @@ -17,6 +18,20 @@
except ImportError:
import tempfile

warnings.warn("Could not import memory_tempfile. Falling back to tempfile.")
except Exception as e:
import tempfile

warnings.warn(
"Could not create MemoryTempfile. Falling back to tempfile. "
"Without the /tmp directory, this may lead to slower pc_error metrics. "
"If you have a tmpfs at a different location, consider specifying it: "
"tempfile = MemoryTempfile(['/path/to/tmpdir']). "
"Otherwise, you can ignore this warning, since the default works too. "
"Exception message:\n"
f"{''.join(traceback.format_exception(None, e, e.__traceback__))}"
)


def pc_write(pc: np.ndarray, file):
assert pc.ndim == 2 and pc.shape[1] == 3
Expand Down

0 comments on commit d4bf844

Please sign in to comment.