diff --git a/lbrynet/core/file_utils.py b/lbrynet/core/file_utils.py deleted file mode 100644 index 7ec9be280..000000000 --- a/lbrynet/core/file_utils.py +++ /dev/null @@ -1,17 +0,0 @@ -import os -from contextlib import contextmanager - - -@contextmanager -def get_read_handle(path): - """ - Get os independent read handle for a file - """ - - if os.name == "nt": - file_mode = 'rb' - else: - file_mode = 'r' - read_handle = open(path, file_mode) - yield read_handle - read_handle.close() diff --git a/lbrynet/daemon/Publisher.py b/lbrynet/daemon/Publisher.py index ee7045cfc..5c76ddb1d 100644 --- a/lbrynet/daemon/Publisher.py +++ b/lbrynet/daemon/Publisher.py @@ -5,7 +5,6 @@ from binascii import hexlify from twisted.internet import defer -from lbrynet.core import file_utils from lbrynet.file_manager.EncryptedFileCreator import create_lbry_file from lbrynet.wallet.account import get_certificate_lookup @@ -32,7 +31,7 @@ class Publisher: raise Exception("Cannot publish empty file {}".format(file_path)) file_name = os.path.basename(file_path) - with file_utils.get_read_handle(file_path) as read_handle: + with open(file_path, 'rb') as read_handle: self.lbry_file = yield create_lbry_file( self.blob_manager, self.storage, self.payment_rate_manager, self.lbry_file_manager, file_name, read_handle