crowdata / debug.py
YOSOYYONOSOYOTRO's picture
Upload folder using huggingface_hub (part 2)
4223796 verified
Raw
History Blame Contribute Delete
675 Bytes
with open(r'E:\crowdata\backend\app\utils\http_client.py', 'rb') as f:
c = f.read()
with open('debug_output.txt', 'w') as out:
out.write(f'Total length: {len(c)}\n')
out.write(f'First 200 bytes: {c[:200]!r}\n')
out.write(f'Has BOM: {c.startswith(b"\xef\xbb\xbf")}\n')
idx = c.find(b'headers={')
if idx >= 0:
out.write(f'Found at index {idx}\n')
out.write(c[idx:idx+200].decode('utf-8', errors='replace'))
else:
out.write('Not found\n')
# Check for non-ASCII
for i, b in enumerate(c):
if b >= 128:
out.write(f'Non-ASCII at {i}: 0x{b:02x} ({chr(c[i]) if c[i] < 256 else "?"})\n')
break