AttributeError: 'AudioFileClip' object has no attribute 'reader' - python

when i tried to run this code, i got the "AttributeError" but idk why? please help me.
import os
import random
from moviepy.editor import *
List_image = os.listdir("müzik\kapaklar")
kapak_num = random.sample(range(1,len(List_image)+1),len(List_image))
List_songs = os.listdir("müzik\hazırlanacaklar")
for x in range(len(List_songs)):
songs = List_songs[x+1]
kapak = List_image[kapak_num[x+1]]
audio = AudioFileClip(songs) ### problem is here ###
image = ImageClip(kapak).set_duration(audio.duration)
video = image.set_audio(audio)
outfile = f"müzik\yapılanlar\%n_with_image.mp4",songs
video.write_videofile(outfile, fps=1)
error message:
C:\Users\erkan\Desktop\ChatCop\venv\Scripts\python.exe "C:/Users/erkan/Desktop/ChatCop/deus ex machina.py"
Traceback (most recent call last):
File "C:/Users/erkan/Desktop/ChatCop/deus ex machina.py", line 15, in <module>
audio = AudioFileClip(songs) # sıkıntı burada
File "C:\Users\erkan\Desktop\ChatCop\venv\lib\site-packages\moviepy\audio\io\AudioFileClip.py", line 72, in __init__
buffersize=buffersize)
File "C:\Users\erkan\Desktop\ChatCop\venv\lib\site-packages\moviepy\audio\io\readers.py", line 50, in __init__
infos = ffmpeg_parse_infos(filename)
File "C:\Users\erkan\Desktop\ChatCop\venv\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 276, in ffmpeg_parse_infos
"path.")%filename)
OSError: MoviePy error: the file 70s Japanese Jazz Mix (Rare Groove, Jazz-Funk, Hard Bop, Modal, Fusion, Breaks).mp3 could not be found!
Please check that you entered the correct path.
Exception ignored in: <bound method AudioFileClip.__del__ of <moviepy.audio.io.AudioFileClip.AudioFileClip object at 0x0000026210D45710>>
Traceback (most recent call last):
File "C:\Users\erkan\Desktop\ChatCop\venv\lib\site-packages\moviepy\audio\io\AudioFileClip.py", line 94, in __del__
self.close()
File "C:\Users\erkan\Desktop\ChatCop\venv\lib\site-packages\moviepy\audio\io\AudioFileClip.py", line 89, in close
if self.reader:
AttributeError: 'AudioFileClip' object has no attribute 'reader'
Process finished with exit code 1

Related

Unable to create owl:NamedIndividual on owlready2

I need to create a NamedIndividual (https://www.w3.org/TR/owl2-syntax/#Named_Individuals) but I am not seeing a way to do it.
The following example:
from owlready2 import *
onto = get_ontology("example")
class NamedIndividual(Thing): namespace = owl
print(NamedIndividual.iri)
print(NamedIndividual.name)
mini = NamedIndividual()
onto.save("minrep.rdf")
Gives the following error:
http://www.w3.org/2002/07/owl#NamedIndividual
NamedIndividual
Traceback (most recent call last):
File "minrep.py", line 13, in <module>
mini = NamedIndividual("example")
File "/home/lubianat/Documents/main_venv/lib/python3.8/site-packages/owlready2/individual.py", line 137, in __init__
if self.storid > 0: self.namespace.ontology._add_obj_triple_spo(self.storid, rdf_type, owl_named_individual)
TypeError: '>' not supported between instances of 'str' and 'int'
If I instantiate the class without a name, I get another error:
http://www.w3.org/2002/07/owl#NamedIndividual
NamedIndividual
Traceback (most recent call last):
File "minrep.py", line 13, in <module>
mini = NamedIndividual()
File "/home/lubianat/Documents/main_venv/lib/python3.8/site-packages/owlready2/individual.py", line 123, in __init__
iri = self.namespace.world._new_numbered_iri("%s%s" % (self.namespace._base_iri, self.generate_default_name()))
AttributeError: 'World' object has no attribute '_new_numbered_iri'
Any ideas on what is happening there? Thanks!

How to fix AttributeError with ImageTk and Tkinter in python3.6?

Traceback (most recent call last):
File "C:/Users/Murad/PycharmProjects/OmrTest/images/GUI.py", line 765, in <module>
obj = Login(master)
File "C:/Users/Murad/PycharmProjects/OmrTest/images/GUI.py", line 35, in __init__
self.bg = ImageTk.PhotoImage(file="unnamed.png")
File "C:\Users\Murad\PycharmProjects\OmrTest\venv\lib\site-packages\PIL\ImageTk.py", line 89, in __init__
image = _get_image_from_kw(kw)
File "C:\Users\Murad\PycharmProjects\OmrTest\venv\lib\site-packages\PIL\ImageTk.py", line 58, in _get_image_from_kw
return Image.open(source)
File "C:\Users\Murad\PycharmProjects\OmrTest\venv\lib\site-packages\PIL\Image.py", line 2904, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'unnamed.png'
Exception ignored in: <bound method PhotoImage.__del__ of <PIL.ImageTk.PhotoImage object at 0x000002A705690748>>
Traceback (most recent call last):
File "C:\Users\Murad\PycharmProjects\OmrTest\venv\lib\site-packages\PIL\ImageTk.py", line 118, in __del__
name = self.__photo.name
AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo'
So I was doing a project in pycharm. how do I Solve this problem?
line 35, init self.bg = ImageTk.PhotoImage(file="unnamed.png")
Where is the file unnanmed.png located?
Use :
self.bg= ImageTk.PhotoImage(Image.open(file_path))
file_path should be full or relative path of the file if it is not in the root directory.

what is the replacement of wikipedia.getSite()? or is it still usable?

I ran a pywikibot sample code,
but it is aborted due to AttributeError.
Traceback is ...
Traceback (most recent call last):
File "pwb.py", line 270, in <module>
if not main():
File "pwb.py", line 264, in main
run_python_file(filename, [filename] + args, argvu, file_package)
File "pwb.py", line 109, in run_python_file
main_mod.__dict__)
File ".\cochonBot.py", line 81, in <module>
main()
File ".\cochonBot.py", line 52, in main
stub_list = cat_list_rec(u'遺꾨쪟:?좊쭑湲 遺꾨쪟', stub_ignore_cats)
File ".\cochonBot.py", line 14, in cat_list_rec
cat = catlib.Category(wikipedia.getSite(), top_cat)
AttributeError: 'module' object has no attribute 'getSite'
<type 'exceptions.AttributeError'>
CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
what is the replacement of wikipedia.getSite()? or is it still usable?
You can simply use pywikibot.Site() instead.

Python execvp error

I wrote the following two pieces of code:
The first one is called_Process.py
print("Hello Python!!")
closeInput = raw_input("Press Enter to exit")
print "Closing calledProcess"
The second program is calling_Process.py which calls the above program:
import os
import sys
program = "python"
print("Process Calling")
arguments = ["called_Process.py"]
os.execvp(program, (program,) + tuple(arguments))
print("Finished calling called_Process!!")
When I run calling_Process.py on Windows using python 3.6.0, I get the following error:
Process Calling
Traceback (most recent call last):
File "C:/Users/ND/Desktop/calling_Process.py", line 14, in <module>
os.execvp(program, (program,) + tuple(arguments))
File "C:\Users\ND\AppData\Local\Programs\Python\Python36\lib\os.py", line 623, in execvp
_execvpe(file, args)
File "C:\Users\ND\AppData\Local\Programs\Python\Python36\lib\os.py", line 668, in _execvpe
raise last_exc.with_traceback(tb)
File "C:\Users\ND\AppData\Local\Programs\Python\Python36\lib\os.py", line 658, in _execvpe
exec_func(fullname, *argrest)
FileNotFoundError: [Errno 2] No such file or directory
>>> os.environ()
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
os.environ()
TypeError: '_Environ' object is not callable
Can someone help me understand what is causing this error?

wxpython GetStatusText()

Hey, I have a wxpython frame object with a status bar. I can do self.SetStatusText() without any trouble, but when I do self.GetStatusText() I get this error:
Traceback (most recent call last):
File
"D:\python\code\test.pyw",
line 87, in <module>
frame = mainframe() File "D:\python\code\test.pyw",
line 40, in __init__
self.serverfield.SetValue(self.serverinfo())
File
"D:\python\code\test.pyw",
line 78, in serverinfo
status = self.GetStatusText(0) AttributeError: 'mainframe' object has
no attribute 'GetStatusText'
Because there is no such function. See the documentation. Try self.GetStatusBar().GetStatusText(), as defined here.

Categories

Resources