twstock icon indicating copy to clipboard operation
twstock copied to clipboard

'OutStream' object has no attribute 'readable'

Open jimmyyyeh opened this issue 5 years ago • 1 comments

作業系統 win10 python版本 python3 ide jupyter notebook

pip install後要import 出現如圖情形 想問一下該怎麼解? messageImage_1581479623699

jimmyyyeh avatar Feb 12 '20 04:02 jimmyyyeh

開啟twstock/twstock/cli/best_four_point.py 並將所有stdout的刪除:

# -*- coding: utf-8 -*-

import io
import sys
import twstock

# XXX: Repalce sys.stdout prevent Windows UnicodeEncodeError on cmd.exe
#stdout = io.TextIOWrapper(
#    getattr(sys.stdout, 'buffer', sys.stdout), encoding='utf-8', errors='replace')


def run(argv):
    print('四大買賣點判斷 Best Four Point')
    print('------------------------------')
    for sid in argv:
        bfp = twstock.BestFourPoint(twstock.Stock(sid))
        bfp = bfp.best_four_point()
        print('%s: ' % (sid), end='')
        if bfp:
            if bfp[0]:
                print('Buy  ', bfp[1])
            else:
                print('Sell ', bfp[1])
        else:
            print("Don't touch")

joytsay avatar May 04 '20 08:05 joytsay