duanqinqiao4844 2019-06-20 10:10
浏览 193

AttributeError'str'对象没有属性'read'

I want to integrate my existing PHP app with new Django framework. I am using the django-php-bridge https://github.com/winhamwr/django-php-bridge

What i want is to be authenticated into the django app by using existing PHP authentication method. I am able to generate session key by PHP and want to put it on Django Session table using the bridge. but i am running into errors. can you suggest a better alternative to the problem ?

 def _unserialize():
        type_ = fp.read(1).lower()
        if type_ == b'n':
            _expect(b';')
            return None
        if type_ in b'idb':
            _expect(b':')
            data = _read_until(b';')
            if type_ == b'i':
                return int(data)
            if type_ == b'd':
                return float(data)
            return int(data) != 0
        if type_ == b's':
            _expect(b':')
            length = int(_read_until(b':'))
            _expect(b'"')
            data = fp.read(length)
            _expect(b'"')
            if decode_strings:

Request Method: | GET
-- | --
http://localhost:8000/
2.2.2
AttributeError
'str' object has no attribute 'read'
C:\xampp\htdocs\test\dbs\env\lib\site-packages\phpserialize.py in _unserialize, line 473
C:\xampp\htdocs\test\dbs\env\Scripts\python.exe
3.7.3
['C:\\xampp\\htdocs\\test\\dbs',  'C:\\xampp\\htdocs\\test\\dbs\\env\\Scripts\\python37.zip',  'C:\\xampp\\htdocs\\test\\dbs\\env\\DLLs',  'C:\\xampp\\htdocs\\test\\dbs\\env\\lib',  'C:\\xampp\\htdocs\\test\\dbs\\env\\Scripts',  'c:\\users\\arjun soota\\appdata\\local\\programs\\python\\python37-32\\Lib',  'c:\\users\\arjun soota\\appdata\\local\\programs\\python\\python37-32\\DLLs',  'C:\\xampp\\htdocs\\test\\dbs\\env',  'C:\\xampp\\htdocs\\test\\dbs\\env\\lib\\site-packages']
Thu, 20 Jun 2019 11:46:50 +0530

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python
    • ¥15 要给毕业设计添加扫码登录的功能!!有偿
    • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥15 stable diffusion
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条