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
wso2-am
bluetooth
amazon-ec2
oracle11g
minimum-spanning-tree
single-sign-on
spagobi
graphql
icloud
disassembler
pivotal-cloud-foundry
django-imagekit
amazon-cloudformation
gitpitch
python-unittest
fancybox-3
izpack
dax
flask-wtforms
quickfix
clearcase-ucm
dosgi
saxon
undefined
samoa
karma-jasmine
autocad-plugin
errorlevel
mmap
autosys
apache-commons-io
dynamic-featured-image
fluentvalidation
windows-server-2000
webkitspeechrecognition
unboundid
language-concepts
cloud-code
dosbox
dartium
adobe-premiere
code-search-engine
sharefile
trim
g-code
botbuilder
osx-mavericks
promela
jlink
return-value
gabor-filter
pg-dump
akka-cluster
color-profile
dwscript
orthogonal
xcb
passport-google-oauth
log4c
ado.net-entity-data-model
thrust
transmitfile
disque
make-install
hexdump
livequery
php-internals
freelancer.com-api
natvis
thredds
marching-cubes
twirl
p2
skos
inmobi
system.reflection
tween
nstableviewcell
android-nested-fragment
wordpress-theme-customize
java-metro-framework
gulp-less
rdl
navigationservice
meteor-velocity
cloud-connect
industrial
blending
ril
ora-00911
buster.js
xamlparseexception
kyotocabinet
specification-pattern
pvrtc
bitsharp
rdoc
gdata-api
dice
uiviewanimation-curve
osql
punbb
spyware
ecl
sudzc
suppress
mozilla-prism
bespin
memory-size
swing-app-framework
windows-live-messenger

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App