[Samba] samba-tool user syncpasswords crashes with python3

Rowland penny rpenny at samba.org
Fri Oct 4 20:45:23 UTC 2019

On 04/10/2019 15:28, Heinz Hölzl via samba wrote:
> the script works...

The script may work when you run it manually, but the error samba-tool 
throws is this:

ERROR(<class 'TypeError'>): uncaught exception - memoryview: a 
bytes-like object is required, not 'str'

If you examine the error, samba-tool runs your script with this:

line 2001, in run_sync_command
     reply = bytes(sync_command_p.communicate(input)[0], encoding = 'utf-8')

After that 'subprocess.py' is called and the error seems to coming from 
there. Samba doesn't import all of 'subprocess', it only does this: from 
subprocess import Popen, PIPE, STDOUT, check_call, CalledProcessError

The error output goes on to do this:

   File "/usr/lib/python3.6/subprocess.py", line 863, in communicate
     stdout, stderr = self._communicate(input, endtime, timeout)
   File "/usr/lib/python3.6/subprocess.py", line 1519, in _communicate
     input_view = memoryview(self._input)

And it is 'memoryview' that throws the error and it looks like it is 
something in subprocess.py that is wrong, or something in your script. 
Samba, as far as I can see, does not use 'memoryview' directly.


More information about the samba mailing list