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

来源:5-5 python读取PDF文档(二)

慕粉1180023

2016-09-24 09:48

为啥这么报错= = 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)


写回答 关注

6回答

  • 慕移动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  没错啊感觉

    奇怪了


    秋名山车神

    把代码贴出来看看

    2016-10-09 14:41:12

    共 1 条回复 >

  • 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)


python遇见数据采集

本教程让你初步掌握Python进行数据采集,创造属于你的价值

59669 学习 · 200 问题

查看课程

相似问题