Skip to content

Commit d988393

Browse files
committed
DEBUG stuff
1 parent bc919cc commit d988393

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

.github/workflows/windows_wheel.yaml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ jobs:
183183
export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}
184184
export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}
185185
export FFMPEG_VERSION_FOR_TESTS=${{ matrix.ffmpeg-version-for-tests }}
186+
export BUILD_AGAINST_ALL_FFMPEG_FROM_S3=1
186187
187188
# Prepare conda
188189
set +x && eval "$($(which conda) shell.bash hook)" && set -x
@@ -213,8 +214,32 @@ jobs:
213214
# Install torchcodec from source in development mode
214215
pip install -e ".[dev]" --no-build-isolation -vv
215216
216-
# Test torchcodec import
217-
python -c "import torchcodec; print('TorchCodec import successful!')"
217+
# Add torchcodec source directory to DLL search path for Windows
218+
torchcodec_dll_path="$(pwd)/src/torchcodec"
219+
echo "Adding torchcodec DLL path: $torchcodec_dll_path"
220+
export PATH="$torchcodec_dll_path:$PATH"
221+
222+
# Test torchcodec import with detailed error reporting
223+
python -c "
224+
import torch
225+
print(f'PyTorch version: {torch.__version__}')
226+
227+
try:
228+
import torchcodec
229+
print('TorchCodec import successful!')
230+
except Exception as e:
231+
print(f'TorchCodec import failed: {e}')
232+
import traceback
233+
traceback.print_exc()
234+
235+
# Try to get more specific error info
236+
try:
237+
from torchcodec._core import ops
238+
print('Core ops import successful')
239+
except Exception as ops_e:
240+
print(f'Core ops import failed: {ops_e}')
241+
traceback.print_exc()
242+
"
218243
219244
# Run tests
220245
pytest test -vvv

src/torchcodec/_core/ops.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ def load_torchcodec_shared_libraries():
5858
if sys.platform == "win32":
5959
try:
6060
import ctypes
61+
62+
# Add the DLL directory to help with dependency resolution
63+
dll_dir = os.path.dirname(core_path)
64+
if hasattr(os, 'add_dll_directory'):
65+
try:
66+
os.add_dll_directory(dll_dir)
67+
print(f"Added DLL directory: {dll_dir}", flush=True)
68+
except Exception as add_dir_e:
69+
print(f"Could not add DLL directory: {add_dir_e}", flush=True)
70+
6171
# Preload the core library so it's available for dependency resolution
6272
ctypes.CDLL(core_path)
6373
print(f"Preloaded core library via ctypes", flush=True)

0 commit comments

Comments
 (0)