8000 AttributeError: 'RedirectDirent' object has no attribute 'clusterNumber' · Issue #1 · kymeria/pyzim-tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
AttributeError: 'RedirectDirent' object has no attribute 'clusterNumber' #1
Open
@monk678

Description

@monk678

I run this code, but it not work。maybe pyzim have many version? what should I do?

import pyzim
import mmap
with open(zimFile, 'r+b') as f:
    with mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) as mm:
        h = pyzim.Header(mm, 0)
        print(h.articleCount) # 290
        urlPtrList = pyzim.UrlPtrList(h.buf, h.urlPtrPos)
        clusterPtrList = pyzim.ClusterPtrList(h.buf, h.clusterPtrPos)
        print(urlPtrList)
        print(clusterPtrList)
        
        d = pyzim.Dirent(h.buf, urlPtrList[100])
        print("d.url:", d.url) # 'CIM-10: groupe H10-H13.html'
        print("d.title:", d.title) # CIM-10: groupe H10-H13'
        cluster = pyzim.Cluster(h.buf, clusterPtrList[d.clusterNumber])
        print(cluster.get_blob_data(d.blobNumber)) # b'<!DOCTYPE HTML SYSTEM "HTML32.DTD" >\n<html>\n<head>\n<title>CIM-10: groupe...
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-19-23f5bc1c9e66> in <module>
     15         print("d.url:", d.url) # 'CIM-10: groupe H10-H13.html'
     16         print("d.title:", d.title) # CIM-10: groupe H10-H13'
---> 17         cluster = pyzim.Cluster(h.buf, clusterPtrList[d.clusterNumber])
     18         print(cluster.get_blob_data(d.blobNumber)) # b'<!DOCTYPE HTML SYSTEM "HTML32.DTD" >\n<html>\n<head>\n<title>CIM-10: groupe...`

AttributeError: 'RedirectDirent' object has no attribute 'clusterNumber'

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

      0