반응형

출처 : https://stackoverflow.com/questions/54101923/1006-connection-closed-abnormally-error-with-python-3-7-websockets

python 3.7 websockets에서 비정상적으로 1006 접속 종료 오류

저는 python websockets에서 이러한 github 이슈와 같은 문제가 있습니다.
https://github.com/aaugustin/websockets/issues/367

제안된 해결책은 저는 작동하지 않습니다. 제가 본 오류는

websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1006 (connection closed abnormally [internal]), no reason

이는 제 코드입니다.

async def get_order_book(symbol):
    with open('test.csv', 'a+') as csvfile:
        csvw = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL)
        DT = Data(data=data, last_OB_id=ob_id, last_TR_id=tr_id, sz=10, csvw=csvw)

        while True:
            if not websocket.open:
                print('Reconnecting')
                websocket = await websockets.connect(ws_url)
            else:
                resp = await websocket.recv()
                update = ujson.loads(resp)
                DT.update_data(update)

async def get_order_books():
    r = requests.get(url='https://api.binance.com/api/v1/ticker/24hr')
    await asyncio.gather(*[get_order_book(data['symbol']) for data in r.json()])

if __name__ == '__main__':
    asyncio.run(get_order_books())

내가 테스트 한 방법은 인터넷 연결을 종료하는 것이지만 10초 후에도 여전히 1006 오류가 반환됩니다.

Python 3.7 및 Websockets 7.0을 실행하고 있습니다.

당신의 생각이 무엇인지 알려주십시오. 감사합니다!

5개의 답변 중 1개의 답변만 추려냄

저도 같은 문제에 직면했습니다. 잠시 동안 파고들자 다시 연결하라는 여러 버전의 답변을 찾았지만 합리적인 방법이라고 생각하지 않았으므로 더 파고 들었습니다.

DEBUG 레벨 로깅을 활성화하면 파이썬 웹소켓이 기본적으로 핑 패킷을 보내고 응답을 받지 못하면 연결 시간이 초과된다는 것을 알았습니다. 이것이 표준과 일치하는지 확실하지 않지만 적어도 파이썬 스크립트 시간이 초과되는 서버에는 적어도 자바 스크립트의 웹 소켓은 완전히 좋았습니다.

수정은 간단합니다. connect (연결)하기 위한 다른 kw 인수를 추가합니다.

websockets.connect(uri, ping_interval=None)

같은 인자는 서버쪽 함수 serve로 작동해야 합니다.

https://websockets.readthedocs.io/en/stable/api.html에서 정보를 더 얻을 수 있습니다.

반응형
반응형

출처 : https://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked

Git push 에러 '[원격 거부됨] master -> master (브랜치는 현재 체크 아웃되었습니다.)'

어제, 저는 한 머신에서 다른 머신으로 Git 저장소를 성공적으로 복제하는 방법 저는 'git clone'을 다른 머신에서 어떻게 할 수 있나요? 에 대한 질문을 작성하였습니다.

저는 성공적으로 제 원본(192.168.1.2)에서 목적지(192.168.1.1)로 Git 저장소를 성공적으로 복제하였습니다.
하지만 파일을 편집을 하였고 git commit -a -m "test"git push를 하였는데 목적지에서 이 오류가 나왔습니다.

git push                                                
hap@192.168.1.2's password: 
Counting objects: 21, done.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 1010 bytes, done.
Total 11 (delta 9), reused 0 (delta 0)
error: refusing to update checked out branch: refs/heads/master
error: By default, updating the current branch in a non-bare repository
error: is denied, because it will make the index and work tree inconsistent
error: with what you pushed, and will require 'git reset --hard' to match
error: the work tree to HEAD.
error: 
error: You can set 'receive.denyCurrentBranch' configuration variable to
error: 'ignore' or 'warn' in the remote repository to allow pushing into
error: its current branch; however, this is not recommended unless you
error: arranged to update its work tree to match what you pushed in some
error: other way.
error: 
error: To squelch this message and still keep the default behaviour, set
error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To git+ssh://hap@192.168.1.2/media/LINUXDATA/working
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'git+ssh://hap@192.168.1.2/media/LINUXDATA/working'

저는 Git(원격에서는 1.7 로컬 머신에서는 1.5)의 2가지 버전을 사용하고 있습니다. 이것이 가능한 이유일까요?

31개의 답변 중 1개의 답변만 추려냄

당신은 간단하게 원격 저장소를 bare 저장소로 변경하면 됩니다. (bare 저장소에는 작업 복사본이 없습니다. - 폴더에는 실제 저장소 데이터만 포함됩니다)

당신의 원격 저장소 폴더에서 다음 명령어를 실행합니다.

git config --bool core.bare true

그리고 나서 .git 폴더를 제외하고 모든 파일을 지웁니다. 그리고 나서 당신은 오류 없이 원격 저장소로 git push를 실행할 수 있을 것입니다.

반응형

+ Recent posts