问答详情
源自:5-5 python读取PDF文档(二)

为啥这么报错= = ValueError: chr() arg not in range(256)

为啥这么报错= = ValueError: chr() arg not in range(256)

C:\Python27\python.exe E:/download/python/crawler.py

Traceback (most recent call last):

  File "E:/download/python/crawler.py", line 26, in <module>

    from pdfminer.converter import PDFPageAggregator

  File "C:\Python27\lib\site-packages\pdfminer\converter.py", line 4, in <module>

    from .pdfdevice import PDFTextDevice

  File "C:\Python27\lib\site-packages\pdfminer\pdfdevice.py", line 2, in <module>

    from .utils import mult_matrix, translate_matrix

  File "C:\Python27\lib\site-packages\pdfminer\utils.py", line 212, in <module>

    0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,

  File "C:\Python27\lib\site-packages\pdfminer\utils.py", line 180, in <genexpr>

    PDFDocEncoding = ''.join( chr(x) for x in (

ValueError: chr() arg not in range(256)


提问者:慕粉1180023 2016-09-24 09:48

个回答

  • 慕移动9181930
    2022-03-27 17:37:53

    可以啊,我用谷歌试过,没有问题。你没有写其他浏览器的兼容代码,所以有问题~线

  • qq_忆昔_0
    2018-07-30 20:25:47

    我也遇到了同样的问题,且装的是pdfminer

  • 帝林大人
    2018-04-20 18:10:46

    utils.py里面的chr(x)改成unichr(x)即可

  • SuperDi
    2017-07-25 10:34:17

    卸载pdfminer3k,装pdfminer2

  • 慕粉1180023
    2016-10-05 19:00:27

    Traceback (most recent call last):

      File "C:\Users\Administrator\PycharmProjects\python\baike\spider_main.py", line 33, in <module>

        obj_spider.craw(root_url)

      File "C:\Users\Administrator\PycharmProjects\python\baike\spider_main.py", line 20, in craw

        new_urls,new_data=self.parser.parse(new_url,html_cont)

    TypeError: 'NoneType' object is not iterable

    检查了地址会不会返回NONE  没错啊感觉

    奇怪了


  • nathansz
    2016-09-25 10:39:20

    看不到代码,但是看起来并不会有问题:

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    
    str = "-"
    
    re = str.join(chr(x) for x in range(10))
    
    print(re)