Skip to content

[Feature request] Add PosixPath object support for python r2pipe #109

Open
@dukebarman

Description

@dukebarman

In Python3 if you use pathlib module for parsing files from a directory, you get results in PosixPath objects. When you send it to r2 = r2pipe.open(filename), you receive an error:

File "main.py", line 30, in is_binary
    r2 = r2pipe.open(filename)
  File "/usr/local/lib/python3.7/site-packages/r2pipe/open_sync.py", line 32, in __init__
    super(open, self).__init__(filename, flags)
  File "/usr/local/lib/python3.7/site-packages/r2pipe/open_base.py", line 132, in __init__
    if filename.startswith("#!pipe"):
AttributeError: 'PosixPath' object has no attribute 'startswith'

And you need convert this path to string: r2 = r2pipe.open(str(filename)). It would be good add support or check this functionality in r2pipe python module.

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