• 카테고리

    질문 & 답변
  • 세부 분야

    프로그래밍 언어

  • 해결 여부

    미해결

webbroswer 질문

23.06.22 03:57 작성 조회수 211

0

 안녕하세요 영상에 나온대로 webbrowser 코드를 그대로 작성했으나 실행이 되질 않습니다. 근데 밑 코드에 추가로 time.sleep을 넣어주면 또 실행이 돼요. 이유가 무엇인지 궁금합니다.


import webbrowser 
webbrowser.open('https://www.naver.com/')


답변 2

·

답변을 작성해보세요.

0

안녕하세요.

이상하네요. sleep 이 없어도 실행이 되야 하는데 해당 브라우저 실행 권한이나, 다른 이유가 있는 것으로 보여요

소스상에 문제가 없으면 환경을 바꿔서 해봐야 될 것 같습니다.(다른 pc 등)

webbrowser.open(url, new=0, autoraise=True)

Display url using the default browser. If new is 0, the url is opened in the same browser window if possible. If new is 1, a new browser window is opened if possible. If new is 2, a new browser page (“tab”) is opened if possible. If autoraise is True, the window is raised if possible (note that under many window managers this will occur regardless of the setting of this variable).

Note that on some platforms, trying to open a filename using this function, may work and start the operating system’s associated program. However, this is neither supported nor portable.

Raises an auditing event webbrowser.open with argument url.

webbrowser.open_new(url)

Open url in a new window of the default browser, if possible, otherwise, open url in the only browser window.

0

강성준님의 프로필

강성준

질문자

2023.06.22

추가로 전 open과 open_new의 실행결과 차이가 전혀 없는데 왜 그럴까용,,