2017-11-28 3 views
0

나는 파이썬에 관한 15 세 이상의 책에서 발견 한 다음 코드를 사용하고 싶습니다 (우리는 현재 파이썬 2.7을 사용하고 있기 때문에 백 포트 문제 때문에 파이썬 3에 갈 것입니다. 주요 프로젝트).파이썬 - 찾을 수 없습니다 fcntl.FNDELAY

import os, popen2, fcntl, select 

def makeNonBlocking(fd): 
    fl = fcntl.fcntl(fd, fcntl.F_GETFL) 
    try: 
     fcntl.fcntl(fd, fcntl.F_SETFL, fl | fcntl.O_NDELAY) 
    except AttributeError: 
     fcntl.fcntl(fd, fcntl.F_SETFL, fl | fcntl.FNDELAY) 

'fcntl.FNDELAY'특성을 찾을 수 없다는 것이 문제입니다. 1 시간 넘게 인터넷 검색이 끝났습니다. 에 NULL 문을 사용하여 코드를 교체하는 것은 리눅스 민트 17.3

+0

가능한 복제본 [python의 fcntl 모듈의 위치는 어디입니까?] (https://stackoverflow.com/questions/7723571/where-is-the-location-of-the-fcntl-module-of- python) – Robin

답변

0

빠른 인터넷 검색 당신은 아마 어떤 점 또한 os.FNDELAY로 알고 있었다 os.O_NDELAY를 찾고 있습니다

OS를 fcntl.O_NDELAY

을 제안한다 찾는 것을 확인합니다.

+0

https://bugs.python.org/file2321/utils.py의 시작 부분에서 try/except를 참조하십시오. – tripleee

관련 문제