python webbrowser
解決済
回答 1
投稿
- 評価
- クリップ 0
- VIEW 949
pythonでちょっとしたブックマーク機能のプログラムを組みました。
import webbrowser
print('Bookmark List')
print('1:google')
print('2:yahoo')
print('3:buhidoh')
print('4:teratail')
print('5:garunimo')
print('6:manga')
print('7:youtube')
bookmark = input('bookmark:')
if bookmark == '1':
url = 'http://www.google.co.jp/'
webbrowser.open(url)
elif bookmark == '2':
url = 'http://www.yahoo.co.jp/'
webbrowser.open(url)
elif bookmark == '3':
url = 'http://www.buhidoh.net/'
webbrowser.open(url)
elif bookmark == '4':
url = 'http://www.teratail.com/users/berry/Reply'
webbrowser.open(url)
elif bookmark == '5':
url = 'http://www.garunimo.com/'
webbrowser.open(url)
elif bookmark == '6':
url = 'http://www.mangamatome.net'
webbrowser.open(url)
elif bookmark == '7':
url = 'http://youtube.co.jp'
webbrowser.open(url)
else:
print('bookmarkにありません')
といったものです。結果はちゃんと機能します。しかし、terminalに
(process:10320): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
@chrome://browser/content/content.js:44:5
addTab@chrome://browser/content/tabbrowser.xml:1803:15
loadOneTab@chrome://browser/content/tabbrowser.xml:1413:23
nsBrowserAccess.prototype._openURIInNewTab@chrome://browser/content/browser.js:15680:15
nsBrowserAccess.prototype.openURI@chrome://browser/content/browser.js:15753:23
handURIToExistingBrowser@jar:file:///usr/lib/firefox/browser/omni.ja!/components/nsBrowserContentHandler.js:697:1
dch_handle@jar:file:///usr/lib/firefox/browser/omni.ja!/components/nsBrowserContentHandler.js:825:11
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
_loadURIWithFlags@chrome://browser/content/browser.js:12079:7
loadURIWithFlags@chrome://browser/content/tabbrowser.xml:6090:13
addTab@chrome://browser/content/tabbrowser.xml:1858:17
loadOneTab@chrome://browser/content/tabbrowser.xml:1413:23
nsBrowserAccess.prototype._openURIInNewTab@chrome://browser/content/browser.js:15680:15
nsBrowserAccess.prototype.openURI@chrome://browser/content/browser.js:15753:23
handURIToExistingBrowser@jar:file:///usr/lib/firefox/browser/omni.ja!/components/nsBrowserContentHandler.js:697:1
dch_handle@jar:file:///usr/lib/firefox/browser/omni.ja!/components/nsBrowserContentHandler.js:825:11
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
TabsProgressListener.onStateChange@chrome://browser/content/browser.js:15551:9
callListeners@chrome://browser/content/tabbrowser.xml:538:24
_callProgressListeners@chrome://browser/content/tabbrowser.xml:559:13
mTabProgressListener/<._callProgressListeners@chrome://browser/content/tabbrowser.xml:596:22
mTabProgressListener/<.onStateChange@chrome://browser/content/tabbrowser.xml:752:1
t.O<@https://www.google.com/js/bg/9LOvvS8UixhmLw-NHg4R4bm77aHKTafT_BPUICERNo0.js line 1 > eval:1:5279
D.prototype.H@https://www.google.com/js/bg/9LOvvS8UixhmLw-NHg4R4bm77aHKTafT_BPUICERNo0.js line 1 > eval:1:8952
D@https://www.google.com/js/bg/9LOvvS8UixhmLw-NHg4R4bm77aHKTafT_BPUICERNo0.js line 1 > eval:1:2028
g.si/<@https://s.ytimg.com/yts/jsbin/www-en_US-vflp5gyXL/common.js:30:47
Ha/<@https://s.ytimg.com/yts/jsbin/spf-vflbit-XM/spf.js:14:477
u@https://s.ytimg.com/yts/jsbin/spf-vflbit-XM/spf.js:7:721
Ha@https://s.ytimg.com/yts/jsbin/spf-vflbit-XM/spf.js:14:441
Ua@https://s.ytimg.com/yts/jsbin/spf-vflbit-XM/spf.js:17:285
l/<@https://s.ytimg.com/yts/jsbin/spf-vflbit-XM/spf.js:7:132
といったものが表示されます。これは、一体どういういみなのでしょうか?
解答のほどよろしくおねがいします。
import webbrowser
print('Bookmark List')
print('1:google')
print('2:yahoo')
print('3:buhidoh')
print('4:teratail')
print('5:garunimo')
print('6:manga')
print('7:youtube')
bookmark = input('bookmark:')
if bookmark == '1':
url = 'http://www.google.co.jp/'
webbrowser.open(url)
elif bookmark == '2':
url = 'http://www.yahoo.co.jp/'
webbrowser.open(url)
elif bookmark == '3':
url = 'http://www.buhidoh.net/'
webbrowser.open(url)
elif bookmark == '4':
url = 'http://www.teratail.com/users/berry/Reply'
webbrowser.open(url)
elif bookmark == '5':
url = 'http://www.garunimo.com/'
webbrowser.open(url)
elif bookmark == '6':
url = 'http://www.mangamatome.net'
webbrowser.open(url)
elif bookmark == '7':
url = 'http://youtube.co.jp'
webbrowser.open(url)
else:
print('bookmarkにありません')
といったものです。結果はちゃんと機能します。しかし、terminalに
(process:10320): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
@chrome://browser/content/content.js:44:5
addTab@chrome://browser/content/tabbrowser.xml:1803:15
loadOneTab@chrome://browser/content/tabbrowser.xml:1413:23
nsBrowserAccess.prototype._openURIInNewTab@chrome://browser/content/browser.js:15680:15
nsBrowserAccess.prototype.openURI@chrome://browser/content/browser.js:15753:23
handURIToExistingBrowser@jar:file:///usr/lib/firefox/browser/omni.ja!/components/nsBrowserContentHandler.js:697:1
dch_handle@jar:file:///usr/lib/firefox/browser/omni.ja!/components/nsBrowserContentHandler.js:825:11
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
_loadURIWithFlags@chrome://browser/content/browser.js:12079:7
loadURIWithFlags@chrome://browser/content/tabbrowser.xml:6090:13
addTab@chrome://browser/content/tabbrowser.xml:1858:17
loadOneTab@chrome://browser/content/tabbrowser.xml:1413:23
nsBrowserAccess.prototype._openURIInNewTab@chrome://browser/content/browser.js:15680:15
nsBrowserAccess.prototype.openURI@chrome://browser/content/browser.js:15753:23
handURIToExistingBrowser@jar:file:///usr/lib/firefox/browser/omni.ja!/components/nsBrowserContentHandler.js:697:1
dch_handle@jar:file:///usr/lib/firefox/browser/omni.ja!/components/nsBrowserContentHandler.js:825:11
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
WARNING: content window passed to PrivateBrowsingUtils.isWindowPrivate. Use isContentWindowPrivate instead (but only for frame scripts).
pbu_isWindowPrivate@resource://gre/modules/PrivateBrowsingUtils.jsm:25:14
pbs<@resource://unity/observer.js:38:71
Observer.prototype.observe@resource://unity/observer.js:77:24
TabsProgressListener.onStateChange@chrome://browser/content/browser.js:15551:9
callListeners@chrome://browser/content/tabbrowser.xml:538:24
_callProgressListeners@chrome://browser/content/tabbrowser.xml:559:13
mTabProgressListener/<._callProgressListeners@chrome://browser/content/tabbrowser.xml:596:22
mTabProgressListener/<.onStateChange@chrome://browser/content/tabbrowser.xml:752:1
t.O<@https://www.google.com/js/bg/9LOvvS8UixhmLw-NHg4R4bm77aHKTafT_BPUICERNo0.js line 1 > eval:1:5279
D.prototype.H@https://www.google.com/js/bg/9LOvvS8UixhmLw-NHg4R4bm77aHKTafT_BPUICERNo0.js line 1 > eval:1:8952
D@https://www.google.com/js/bg/9LOvvS8UixhmLw-NHg4R4bm77aHKTafT_BPUICERNo0.js line 1 > eval:1:2028
g.si/<@https://s.ytimg.com/yts/jsbin/www-en_US-vflp5gyXL/common.js:30:47
Ha/<@https://s.ytimg.com/yts/jsbin/spf-vflbit-XM/spf.js:14:477
u@https://s.ytimg.com/yts/jsbin/spf-vflbit-XM/spf.js:7:721
Ha@https://s.ytimg.com/yts/jsbin/spf-vflbit-XM/spf.js:14:441
Ua@https://s.ytimg.com/yts/jsbin/spf-vflbit-XM/spf.js:17:285
l/<@https://s.ytimg.com/yts/jsbin/spf-vflbit-XM/spf.js:7:132
といったものが表示されます。これは、一体どういういみなのでしょうか?
解答のほどよろしくおねがいします。
-
気になる質問をクリップする
クリップした質問は、後からいつでもマイページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
クリップを取り消します
-
良い質問の評価を上げる
以下のような質問は評価を上げましょう
- 質問内容が明確
- 自分も答えを知りたい
- 質問者以外のユーザにも役立つ
評価が高い質問は、TOPページの「注目」タブのフィードに表示されやすくなります。
質問の評価を上げたことを取り消します
-
評価を下げられる数の上限に達しました
評価を下げることができません
- 1日5回まで評価を下げられます
- 1日に1ユーザに対して2回まで評価を下げられます
質問の評価を下げる
teratailでは下記のような質問を「具体的に困っていることがない質問」、「サイトポリシーに違反する質問」と定義し、推奨していません。
- プログラミングに関係のない質問
- やってほしいことだけを記載した丸投げの質問
- 問題・課題が含まれていない質問
- 意図的に内容が抹消された質問
- 広告と受け取られるような投稿
評価が下がると、TOPページの「アクティブ」「注目」タブのフィードに表示されにくくなります。
質問の評価を下げたことを取り消します
この機能は開放されていません
評価を下げる条件を満たしてません
質問の評価を下げる機能の利用条件
この機能を利用するためには、以下の事項を行う必要があります。
- 質問回答など一定の行動
-
メールアドレスの認証
メールアドレスの認証
-
質問評価に関するヘルプページの閲覧
質問評価に関するヘルプページの閲覧
15分調べてもわからないことは、teratailで質問しよう!
- ただいまの回答率 89.97%
- 質問をまとめることで、思考を整理して素早く解決
- テンプレート機能で、簡単に質問をまとめられる