Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
put error "unsupported operand type(s) for &: 'NoneType' and 'int'" #811
When I run a simple put with Fabric 1.5.1 using a mode parameter, I get an error. Here's the fabfile.py:
When I run it, I get this error:
If I take the mode out of the script, it appears to work.
I traced it a bit further, re-raising the original exception rather than masking it. When I did so, I get this traceback:
It seems the latest version of paramiko.sftp_client.SFTPClient.putfo is returning an rattrs where st_mode is None.
That part of Paramiko was modified mid last year to more gracefully handle file sizes and related things, which is what added the "only return a
So this issue is either an oversight in that change (meaning a Paramiko ticket is needed), or there's a conflict of interests going on (in which case it could be fixable there, or maybe worked around here).
If you can poke a bit farther to figure out whether the Paramiko logic is sound (cannot/should not
I've had a very similar problem with 1.6.0:
upload_template(filename=src, destination=dst, mode=0755) # fails upload_template(filename=src, destination=dst) # works
Failure message is: unsupported operand type(s) for &: 'NoneType' and 'int'
Going back to 1.5.4 solved my problem.