What guru can help me get this going

Like most, if not all python tutorials this one doesn’t work.
Driven myself mad for 2 days trying to find the answer, and I know its looking back.
I believe the error is in fresh_tomatoes.py.
I have had all code in a validator, its not perfect, but should work. The main script (the one I believe the problem is in), I will take out most of the html/css, but am happy to post if needed.
This is the error I’m now getting

Traceback (most recent call last):
  File "C:\Python36-32\udacity\movies\entertainment_center.py", line 7, in <module>
    "https://www.youtube.com/watch?v=7FQ68Rw25gM")
TypeError: object() takes no parameters


This is the part of the script I think is incorrect:

# A single movie entry html template
movie_tile_content = '''
<div class="col-md-6 col-lg-4 movie-tile text-center" data-trailer-youtube-id=
"{trailer_youtube_id}" data-toggle="modal" data-target="#trailer">
    <img src="{poster_image_url}" width="220" height="342">
    <h2>{movie_title}</h2>
</div>

And here are the other 2 parts/scripts - media.py

import webbrowser

class Movie():
    def _init_(self, movie_title, movie_storyline, poster_image, trailer_youtube):
        self.title = movie_title
        self.storyline = movie_storyline
        self.poster_image_url = poster_image
        self.trailer_youtube_url = trailer_youtube
	
def show_trailer(self):
    webbrowser.open(self.trailer_youtube_url)

And here is entertainment-center:

import fresh_tomatoes
import media

toy_story = media.Movie("Toy Story"
                        ,"A story of a boy and his toys that come to life"
                        ,"http://aforismi.meglio.it/img/film/Toy_story.jpg",
                        "https://www.youtube.com/watch?v=7FQ68Rw25gM")

avatar = media.Movie("Avatar",
                     "A marine on an alien planet"
                     ,"http://upload.wikimedia.org/wikipedia/id/b/b0/Avatar-Teaser-Poster.jpg",
		      "https://www.youtube.com/watch?v=dCPcoNo_OkM")

vanishing_point = media.Movie("Vanishing Point",
                              "American action road movie",
			      "https://en.wikipedia.org/wiki/Vanishing_Point_(1971_film)#/media/File:Vanishingpointmovieposter.jpg",
			      "https://www.youtube.com/watch?v=xNTWixbq0Oc")

school_of_rock = media.Movie("School of Rock",
                             "American idiot movie",
			     "https://upload.wikimedia.org/wikipedia/en/1/11School_of_Rock_Poster.jpg",
			     "https://www.youtube.com/watch?v=3PSujebc74")

movies = [toy_story,avatar,vanishing_point,school_of_rock]					 
fresh_tomatoes.open_movies_page(movies)

There should be two underscores around init in media.py, so change it to

def __init__(self, movie_title, movie_storyline, poster_image, trailer_youtube):

Also, the show_trailer() method is not properly indented and therefore is not actually part of the Movie class at the moment.

Thanks for the help

I would never have picked up on the double underscore, sure don’t remember reading about it any where.
And the indent - I changed that because when I checked my script at PEP8 it said it was wrong.
Correct now ?:

class Movie():
    def __init__(self, movie_title, movie_storyline, poster_image, trailer_youtube):
        self.title = movie_title
        self.storyline = movie_storyline
        self.poster_image_url = poster_image
        self.trailer_youtube_url = trailer_youtube
	
    def show_trailer(self):
    webbrowser.open(self.trailer_youtube_url)

Correct now ??

    def show_trailer(self):
        webbrowser.open(self.trailer_youtube_url)

This was a python2 tut and I’m using python3. on windows 10
fixes worked but I’m now being asked if I want to open the browser, instead of it just opening, and there’s no images showing.

Feel much better getting this far, much appreciated

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.