begin reading of tel file
"metadata": {},
"outputs": [],
"source": [
+ "import os\n",
+ "import win32file\n",
+ "import msvcrt\n",
+ "\n",
"import pymedphys"
]
},
"metadata": {},
"outputs": [],
"source": [
- "data_paths"
+ "tel_paths = [path for path in data_paths if \"tel\" in path.name]\n",
+ "assert len(tel_paths) == 1\n",
+ "tel_path = tel_paths[0]"
]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "tel_path"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "handle = win32file.CreateFile(\n",
+ " str(tel_path),\n",
+ " win32file.GENERIC_READ,\n",
+ " win32file.FILE_SHARE_DELETE |\n",
+ " win32file.FILE_SHARE_READ |\n",
+ " win32file.FILE_SHARE_WRITE,\n",
+ " None,\n",
+ " win32file.OPEN_EXISTING,\n",
+ " 0,\n",
+ " None)\n",
+ "\n",
+ "\n",
+ "detached_handle = handle.Detach()\n",
+ "\n",
+ "file_descriptor = msvcrt.open_osfhandle(\n",
+ " detached_handle, os.O_RDONLY)\n",
+ "\n",
+ "with open(file_descriptor) as file:\n",
+ " data = file.read()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "data"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
}
],
"metadata": {
