Closed Chris-fullerton closed 1 year ago
Have you tried opening the file in binary mode?
open(combine_paths(self.log_path, export_file_name), "rb")
Have you tried opening the file in binary mode?
open(combine_paths(self.log_path, export_file_name), "rb")
Solved, this works for me 😄.
@miketeo do you think it is necessary to update the exception message for this scenario? If you don't think it's necessary, you can close this issues at any time, because my problem has been solved.
Env: macOS Ventura 13.0 Apple M1, 2020
conda list pysmb
:My Code:
full exception stacks
``` Exception in thread Thread-2 (loop): Traceback (most recent call last): File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/Users/christopherchang/Work/FacePCS/python-package/facepcs/app/export_log.py", line 175, in loop self.smb_transfer(export_file_name) File "/Users/christopherchang/Work/FacePCS/python-package/facepcs/app/export_log.py", line 162, in smb_transfer conn.storeFile("card", export_file_name, export_file) File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/smb/SMBConnection.py", line 376, in storeFile return self.storeFileFromOffset(service_name, path, file_obj, 0, True, timeout, show_progress = show_progress, tqdm_kwargs = tqdm_kwargs) File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/smb/SMBConnection.py", line 408, in storeFileFromOffset self._pollForNetBIOSPacket(timeout) File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/smb/SMBConnection.py", line 649, in _pollForNetBIOSPacket self.feedData(data) File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/nmb/base.py", line 54, in feedData self._processNMBSessionPacket(self.data_nmb) File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/nmb/base.py", line 75, in _processNMBSessionPacket self.onNMBSessionMessage(packet.flags, packet.data) File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/smb/base.py", line 150, in onNMBSessionMessage if self._updateState(self.smb_message): File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/smb/base.py", line 344, in _updateState_SMB2 req.callback(message, **req.kwargs) File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/smb/base.py", line 1105, in createCB sendWrite(create_message.tid, create_message.payload.fid, starting_offset) File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/smb/base.py", line 1116, in sendWrite self._sendSMBMessage(m) File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/smb/base.py", line 236, in _sendSMBMessage_SMB2 raw_data = smb_message.encode() File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/smb/smb2_structs.py", line 79, in encode self.payload.prepare(self) File "/Users/christopherchang/miniconda3/envs/facepcs/lib/python3.10/site-packages/smb/smb2_structs.py", line 465, in prepare message.data = struct.pack(self.STRUCTURE_FORMAT, TypeError: can't concat str to bytes ```