From ed08b50d821b0b2352821c4f4f927bd6bf4d18c6 Mon Sep 17 00:00:00 2001 From: gph82 Date: Thu, 26 Oct 2023 13:39:46 +0200 Subject: [PATCH] [pdb.pdb2traj] increase buffer size The whole pdb file wasn't downloading from response in Linux, but it did on MacOS, although they have the same buffer size (?) --- mdciao/pdb/pdb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mdciao/pdb/pdb.py b/mdciao/pdb/pdb.py index 6ea39cbe..9a00d105 100644 --- a/mdciao/pdb/pdb.py +++ b/mdciao/pdb/pdb.py @@ -24,7 +24,7 @@ from mdtraj import load_pdb as _load_pdb from tempfile import NamedTemporaryFile as _NamedTemporaryFile -from shutil import copy as _copy, copyfileobj as _copyfileobj +from shutil import copy as _copy, copyfileobj as _copyfileobj, COPY_BUFSIZE as _COPY_BUFSIZE from urllib.error import HTTPError as _HTTPError, URLError as _URLError from urllib.request import urlopen as _urlopen @@ -135,7 +135,7 @@ def pdb2traj(code, with _urlopen(url1) as response: if response.status == 200: with _NamedTemporaryFile(delete=True) as tmp_file: - _copyfileobj(response, tmp_file) + _copyfileobj(response, tmp_file, length=_COPY_BUFSIZE*2) geom = _load_pdb(tmp_file.name) if filename is not None: print_v("Saving to %s..." % filename, end="", flush=True)