bitbarプラグインのディレクトリ:~/Documents/bitbar_plugins
上記ディレクトリで、実行すると正常に動作するのですが、bitbar
ではImportError: No module named 'bs4'
と表示されます。
これはなぜなのでしょうか。
事象の画像
コード
python
1#!/usr/bin/env python 2 3# <bitbar.title>Movie Scheduler</bitbar.title> 4# <bitbar.version>v1.0</bitbar.version> 5# <bitbar.author>hanlio</bitbar.author> 6# <bitbar.author.github>hanlio</bitbar.author.github> 7# <bitbar.dependencies>python</bitbar.dependencies> 8 9# coding: UTF-8 10import urllib2 11import datetime 12from bs4 import BeautifulSoup 13 14# Access URL 15url = "http://movie.zashiki.com/calendar/gw/201812.html" 16 17# url remake html 18html = urllib2.urlopen(url) 19 20# html to BeautifulSoup 21soup = BeautifulSoup(html, "html.parser") 22 23# get title 24title = soup.title.string 25 26print title 27 28# get all tr 29tr = soup.find_all("tr") 30 31# get movie title 32movie_title = [] 33 34# today 35dt_now = datetime.datetime.now() 36today = dt_now.strftime('%d') 37 38# find tr 39for tagTR in tr: 40 try: 41 date = tagTR.find("td", "date").string 42 if date: 43 if date.find(today + '(') > 0: 44 movie_title = [] 45 movie_title.append(tagTR.find("td", "date").string) 46 47 time = tagTR.find("td", "time").string 48 title = tagTR.find("td", "title").string 49 movie_title.append( time + " | " + title) 50 pass 51 52 except Exception as e: 53 pass 54 55for t in movie_title: 56 print t
バージョン情報
shell
1$ pip --version 2pip 18.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7) 3 4$pip list 5Package Version 6-------------- ------- 7BeautifulSoup 3.2.1 8beautifulsoup4 4.6.3 9bs4 0.0.1 10pip 18.1 11setuptools 39.1.0 12wheel 0.31.0
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。