Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
imdby package problem
#3
(Sep-04-2023, 01:54 PM)deanhystad Wrote: Post full error message and trace. Or would it be better if I installed the module so I can run your code snd maybe see the error?

My guess would be that tt4154796 is not a valid id. I did type this in as a search on imdb.com and it pulled up Avengers: End Game, so maybe the problem is something else. Hard to say without any information about the error.

Why are you using this package instead of something like Cinemagoer (used to be imdbPy)?

ok so basically i updated my code a bit. I first look for a movie based on title. I then confirm that is the movie the user is looking for. After that i try to receive information about the movie based on the movie ID. However i still have the same problem. Basically i want to be able to get movie data from the movie id variable and use that to print out data like director(s),actor(s) etc. My code is:

import imdb as im
from tkinter import *
from tkinter import simpledialog,messagebox
from imdby.imdb import imdb

def get_data(movie_id):
    details=imdb(movie_id)
    print(details)
    messagebox.showinfo(title="Movie Information",message=f"{details}")

def search_for_film(name):
    cg = im.Cinemagoer()
    search = cg.search_movie(name)

    for i in range(len(search)):
        if messagebox.askokcancel(title=f"Movie Title",message=f"Is {search[i]} the movie you are looking for?"):
            id=search[i].movieID
            get_data(id)
            return id

window=Tk()
ia=im.IMDb()
window.config(padx=50,pady=50)
window.title("Movie Information App")
canvas=Canvas(width=523,height=523)
pic=PhotoImage(file="./IMDb_Jobs_Header_Mobile.png")
bg_img=canvas.create_image(272,272,image=pic)
canvas.grid(row=1,column=0)
movie_name=simpledialog.askstring(title="Movie Information",prompt="Choose a film")
movie_id=search_for_film(movie_name)




window.mainloop()
My current error code is:
Error:
Traceback (most recent call last): File "C:\Users\giorg\PycharmProjects\pythonProject2\IMDB\main.py", line 30, in <module> movie_id=search_for_film(movie_name) File "C:\Users\giorg\PycharmProjects\pythonProject2\IMDB\main.py", line 18, in search_for_film get_data(id) File "C:\Users\giorg\PycharmProjects\pythonProject2\IMDB\main.py", line 7, in get_data details=imdb(movie_id) File "C:\Users\giorg\AppData\Local\Programs\Python\Python39\lib\site-packages\imdby\imdb.py", line 23, in __init__ release_info.__init__(self, titleid) File "C:\Users\giorg\AppData\Local\Programs\Python\Python39\lib\site-packages\imdby\release_info.py", line 28, in __init__ releases_index = [i for i in range(len(soup.select('h4'))) if 'release' in ' '.join(soup.select('h4')[i].text.split()).lower()][0] IndexError: list index out of range
Reply


Messages In This Thread
imdby package problem - by lunacy90 - Sep-04-2023, 12:25 PM
RE: imdby package problem - by deanhystad - Sep-04-2023, 01:54 PM
RE: imdby package problem - by lunacy90 - Sep-04-2023, 02:14 PM
RE: imdby package problem - by lunacy90 - Sep-04-2023, 02:30 PM
RE: imdby package problem - by deanhystad - Sep-04-2023, 02:33 PM
RE: imdby package problem - by lunacy90 - Sep-04-2023, 02:36 PM
RE: imdby package problem - by deanhystad - Sep-04-2023, 02:42 PM
RE: imdby package problem - by lunacy90 - Sep-04-2023, 03:45 PM
RE: imdby package problem - by deanhystad - Sep-04-2023, 07:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem install somewhere package akbarza 1 547 Dec-27-2023, 01:25 PM
Last Post: Gribouillis
  Problem: Restart kernel onPydev console when trying to install a python package poppy2020 1 7,801 Nov-25-2020, 06:13 PM
Last Post: Larz60+
  Problem with importing an installed package Reverend_Jim 4 3,787 Jun-14-2019, 10:20 PM
Last Post: Reverend_Jim
  Problem installing urlparse4 package BobLoblaw 2 5,805 Oct-06-2017, 05:16 PM
Last Post: BobLoblaw

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020