Git Product home page Git Product logo

pyreadpartitions's Introduction

pyreadpartitions

Read MBR and GPT partitions directly in python.

Examples:

from pyreadpartitions import get_disk_partitions_info
with open('/dev/sda', 'rb') as fp:
    info = get_disk_partitions_info(fp)
    print(info.mbr)
    print(info.gpt)
from pyreadpartitions import show_disk_partitions_info
with open('/dev/sda', 'rb') as fp:
    show_disk_partitions_info(fp)

A console script is also available:

$ sudo cat /dev/sda | pyreadpartitions

or if you already have access to a file or directly to the disk:

# pyreadpartitions /dev/sda

pyreadpartitions's People

Contributors

jrd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pyreadpartitions's Issues

error when using pip to install

Obtaining file:///Users/myaccountname/Desktop/pyreadpartitions
    ERROR: Command errored out with exit status 1:
     command: /opt/anaconda3/envs/openea/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/myaccountname/Desktop/pyreadpartitions/setup.py'"'"'; __file__='"'"'/Users/myaccountname/Desktop/pyreadpartitions/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/bq/gkw9g60136138jhd0k4sqzyh0000gn/T/pip-pip-egg-info-65n1xn79
         cwd: /Users/myaccountname/Desktop/pyreadpartitions/
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/myaccountname/Desktop/pyreadpartitions/setup.py", line 49, in <module>
        'license': find_info('license', MODULE_NAME),
      File "/Users/myaccountname/Desktop/pyreadpartitions/setup.py", line 28, in find_info
        info_match = re.search(r"^__{0}__ = {1}".format(info, python_string), info_file, re.M)
      File "/opt/anaconda3/envs/openea/lib/python3.6/re.py", line 182, in search
        return _compile(pattern, flags).search(string)
    TypeError: cannot use a string pattern on a bytes-like object

in order to remove this bug

info_match = re.search(r"^__{0}__ = {1}".format(info, python_string), info_file, re.M)

change to
info_match = re.search(r"^__{0}__ = {1}".format(info, python_string), str(info_file), re.M)

and

info_match = re.search(r"^__{0}__ = {1}".format(info, python_arrays), info_file, re.M)

change to
info_match = re.search(r"^__{0}__ = {1}".format(info, python_arrays), str(info_file), re.M)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.