Skip to content

'Unsupported operand' when giving modes in 'put()' #871

Closed
@bitprophet

Description

@bitprophet

E.g.: in a call like put(StringIO(xxx), yyy, mode="0755") (emphasis is on mode string, not the StringIO, which is incidental):

Fatal error: put() encountered an exception while uploading '<StringIO.StringIO instance at 0x9ddfa8>'

Underlying exception:                                                                                 
    unsupported operand type(s) for &: 'str' and 'int'                                                

Aborting.                                                                                             

Problem is that whoever added the mode stuff is blindly doing lmode & 07777 which dies whenever lmode is a string. Casting to an int appears to work fine for me in the shell, regardless if one gives e.g. "755", "0755", "00755" etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions