python-webbrowser


possible webbrowser implementation differences between python 2.7 and python3


I wrote the following code to run the trailer of a movie as part of a Udacity course. The code runs fine on python2.7 and shows the trailer in default browser I but get the following error when running the same code under python3. I was wondering if someone can point out how to make my code python3 compatible. I have removed some of the links in my code since I do not have 10 reputation points yet. Thanks.
Error in python 3:
AttributeError: 'Movie' object has no attribute 'show_trailer'
The code:
file media.py contains the class media and the method show_trailer
import webbrowser
class Movie():
def __init__(self, movie_title, movie_storyline, movie_poster, movie_trailer, movie_review):
self.title = movie_title
self.storyline = movie_storyline
self.poster_image_url = movie_poster
self.trailer_youtube_url = movie_trailer
self.review = movie_review
def show_trailer(self):
webbrowser.open_new(self.trailer_youtube_url)
file entertainment_center.py is being called (returns error under python3but works fine with python2.7)
import media
toystory = media.Movie("Toy Story", "A story of a boy and his toys that come to life", "link to the movie poster", "https://www.youtube.com/watch?v=KYz2wyBy3kc", "link to the rotten tomatoes review")
avatar = media.Movie("Avatar", "A marine on an alien planet being destroyed by humans", "link to the movie poster", "https://www.youtube.com/watch?v=cRdxXPV9GNQ", "link to the rotten tomatoes review")
avatar.show_trailer()

Related Links

possible webbrowser implementation differences between python 2.7 and python3
Open a download Link , rename file and close webbrowser in Python

Categories

HOME
variables
keycloak
openstack
single-sign-on
dot
youtube-dl
routes
dxl
umd
indesign
azure-storage-tables
constraint-programming
slick-slider
kibana-4
volttron
row
propel
mps
trading
shopware
one-to-many
qhull
nhapi
compatibility
libuv
webkitspeechrecognition
phonegap
twilio-api
uiswipegesturerecognizer
normal-distribution
adobe-premiere
c11
broadcastreceiver
preconditions
dynamic-reports
botbuilder
prolog-setof
multipeer-connectivity
jlink
togetherjs
gabor-filter
feeds
android-cursor
nsarray
zendesk-app
cudafy.net
nbconvert
nested-sets
httplistener
url-masking
file-writing
mikroc
nsfilemanager
merge-conflict-resolution
packagist
livequery
wireshark-dissector
embedded-code
sframe
drawbitmap
composite
python-green
rdtsc
heisenbug
htmlcleaner
comexception
ember-charts
srs
xsockets.net
gridfs
dexterity
qt-faststart
jquery-mobile-dialog
sharp-repository
flashvars
distutils
trusted
runas
tridion-worldserver
bubble-chart
site.master
jquery-ui-droppable
mirah
asp.net-profiles
user-friendly
yagni
windows-live-messenger
ajax-forms

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App