I'm using MoviePy which requires ImageMagick, but when I run my code I receive the following error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/moviepy/video/VideoClip.py", line 1262, in __init__
subprocess_call(cmd, logger=None)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/moviepy/tools.py", line 43, in subprocess_call
raise IOError(err.decode("utf8"))
OSError: convert: label expected `#/var/folders/tw/25c_f4h57bs5hslr5vm1fns80000gq/T/tmpejmzojaq.txt' # error/annotate.c/GetMultilineTypeMetrics/797.
convert: no images defined `PNG32:/var/folders/tw/25c_f4h57bs5hslr5vm1fns80000gq/T/tmp9y2p9b0s.png' # error/convert.c/ConvertImageCommand/3342.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/hypnoticocelot/Downloads/python/tikgenrewrite/tikgen.py", line 366, in <module>
tikgen()
File "/Users/hypnoticocelot/Downloads/python/tikgenrewrite/tikgen.py", line 360, in tikgen
subText = TextClip(subText, font=fontFile, fontsize=75, color=fontColor, stroke_color=strokeColor, stroke_width=3).set_position(("center", 650)).set_duration(mainVideo.duration)
File "<decorator-gen-84>", line 2, in __init__
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/moviepy/decorators.py", line 89, in wrapper
return f(*new_a, **new_kw)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/moviepy/video/VideoClip.py", line 1272, in __init__
raise IOError(error)
OSError: MoviePy Error: creation of None failed because of the following error:
convert: label expected `#/var/folders/tw/25c_f4h57bs5hslr5vm1fns80000gq/T/tmpejmzojaq.txt' # error/annotate.c/GetMultilineTypeMetrics/797.
convert: no images defined `PNG32:/var/folders/tw/25c_f4h57bs5hslr5vm1fns80000gq/T/tmp9y2p9b0s.png' # error/convert.c/ConvertImageCommand/3342.
.
.This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary. Check the documentation.
I thought ImageMagick might not have been installed, but running brew install ImageMagick, I'm already on the latest version and fully updated. I'm using a Mac, so I'm not sure if for some reason the path to the ImageMagick binary is somehow incorrect? But I don't see any way to fix this.
The solution I found was that my TextClip element wasn’t playing nice when the text in the clip was set to "". An if statement checking if it was empty or not fixed it easily.
Related
I am trying to write TextClip into a video with moviepy. It has always been working, yet after I reinstalled ffmpeg, it doesn't work anymore (I am not sure whether it has caused it, but I mentioned it in case it does). Some of the TextClip objects are pure spaces.
I got the following error message:
Traceback (most recent call last):
File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\moviepy\video\VideoClip.py", line 1137, in __init__
subprocess_call(cmd, logger=None)
File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\moviepy\tools.py", line 54, in subprocess_call
raise IOError(err.decode('utf8'))
OSError: magick.exe: no images for write '-write' 'PNG32:C:\Users\USER\AppData\Local\Temp\tmpmnf0fkb5.png' at CLI arg 14 # error/operation.c/CLINoImageOperator/4893.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "media_main_user.py", line 79, in <module>
insert_audio_and_subtitles(input_clip,'output.mp4','text.mp3',subtitles,fontsize=subtitles_font_size,
File "D:\UserData\Desktop\Project\影片剪輯\關鍵字版本\make_media.py", line 318, in insert_audio_and_subtitles
annotated_clips = [annotate(video.subclip(from_t, to_t), txt) for (from_t, to_t), txt in subtitles]
File "D:\UserData\Desktop\Project\影片剪輯\關鍵字版本\make_media.py", line 318, in <listcomp>
annotated_clips = [annotate(video.subclip(from_t, to_t), txt) for (from_t, to_t), txt in subtitles]
File "D:\UserData\Desktop\Project\影片剪輯\關鍵字版本\make_media.py", line 311, in annotate
txtclip = TextClip(txt, fontsize=fontsize, font=font, color=txt_color)
File "C:\Users\USER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\moviepy\video\VideoClip.py", line 1146, in __init__
raise IOError(error)
OSError: MoviePy Error: creation of None failed because of the following error:
magick.exe: no images for write '-write' 'PNG32:C:\Users\USER\AppData\Local\Temp\tmpmnf0fkb5.png' at CLI arg 14 # error/operation.c/CLINoImageOperator/4893.
.
.This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or that the path you specified is incorrect
I have tried to solve the problems multiple ways, like checking the config-default.py file in moviepy installation directory, and the path for ImageMagick it's pointing to is not wrong. I tried to reinstall ImageMagick, it is also of no use. And I tried to edit the policy.xml file in ImageMagick directory from none to read|write, but it also doesn't work. Can anyone suggest other possible solutions?
In /etc/ImageMagick-6/policy.xml try to comment out the following line altogether:
<policy domain="path" rights="none" pattern="#*" />
Like so:
<!-- <policy domain="path" rights="none" pattern="#*" /> -->
I am trying to set up the ChirpSDK, but every time I configure and run the code, I get this error:
Traceback (most recent call last):
File "test.py", line 3, in <module>
chirp = ChirpSDK()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 395, in __init__
self.read_chirprc(block)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 501, in read_chirprc
raise IOError('Could not find a ~/.chirprc file')
OSError: Could not find a ~/.chirprc file
Exception ignored in: <function ChirpSDK.__del__ at 0x10fa31af0>
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 422, in __del__
self.close()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 470, in close
if self._sdk:
AttributeError: 'ChirpSDK' object has no attribute '_sdk'
I realize that the error is saying that my .chirprc file is not being recognized, but I have no idea how to remedy this. I created a .chirprc file in my /Users/username/ path, and named it c.chirprc (as the Chirp getting started article suggests), but I am still getting this error. Is there another part that I am missing? Am I reading the instructions wrong?
Thanks
The Chirp configuration file should be placed at /Users/<username>/.chirprc on macOS.
If you run ls -l ~/.chirprc in the terminal, do you get any results? If it displays no such file or directory then you have not created the file correctly.
I am using the moviepy module for python from here https://github.com/Zulko/moviepy
I had successfully installed moviepy and necessary modules with it. But when I am trying to run the first example of adding Text clip in the video, I am getting error.
Here is my code and my output.
Code:
from moviepy.editor import *
clip = VideoFileClip("video1.mp4").subclip(50, 60)
txt_clip = TextClip("My Holidays 2013", fontsize=70, color='white')
txt_clip = txt_clip.set_pos('center').set_duration(10)
video = CompositeVideoClip([clip, txt_clip])
video.write_videofile("output.mp4")
**NOTE:
Imagemagic is installed correctly as when i type convert in the
terminal i get the version name. Also i can perfectly run the other
examples were there isn't a use of TextClip
I am using ubuntu 16.04 with python3
.**
Output:
[MoviePy] This command returned an error !Traceback (most recent call last):
File "/home/vega6-x3/.local/lib/python3.5/site-packages/moviepy/video/VideoClip.py", line 1220, in __init__
subprocess_call(cmd, verbose=False )
File "/home/vega6-x3/.local/lib/python3.5/site-packages/moviepy/tools.py", line 49, in subprocess_call
raise IOError(err.decode('utf8'))
OSError: convert: not authorized `#/tmp/tmpfa42vkjy.txt' # error/property.c/InterpretImageProperties/3405.
convert: no images defined `PNG32:/tmp/tmpevkkuuf5.png' # error/convert.c/ConvertImageCommand/3210.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/vega6-x3/python/hello.py", line 10, in <module>
txt_clip = TextClip("My Holidays 2013", fontsize=70, color='white')
File "/home/vega6-x3/.local/lib/python3.5/site-packages/moviepy/video/VideoClip.py", line 1229, in __init__
raise IOError(error)
OSError: MoviePy Error: creation of None failed because of the following error:
convert: not authorized `#/tmp/tmpfa42vkjy.txt' # error/property.c/InterpretImageProperties/3405.
convert: no images defined `PNG32:/tmp/tmpevkkuuf5.png' # error/convert.c/ConvertImageCommand/3210.
.
.This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or.that the path you specified is incorrect
Please let me know what wrong i am doing. I am pretty new to python, so not sure what i had done wrong. From what little i can get, it seems to me as a permission issue but exactly sure about this.
Thanks
Adi
Looks like the txt format is disabled on the system (due to security issues).
You can re-enable it by commenting out the line below in policy.xml
<policy domain="coder" rights="none" pattern="TEXT" />
But I wouldn't recommend this on a system the accepts files from the public!
So on my game I'm making, I'm trying to load the data files needed for the game, and when I load the file with pickle (The file has been loaded, I've double-checked that.) I get this error:
Traceback (most recent call last):
File "/Users/user/Downloads/Deeper-master/Deeper.py", line 257, in <module>
tutorialData = pickle.load(tutorialFile)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1384, in load
return Unpickler(file).load()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 864, in load
dispatch[key](self)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1075, in load_inst
klass = self.find_class(module, name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1130, in find_class
__import__(module)
ImportError: No module named __main__
I saw a question like this on Stack Overflow, but it's a little different than my situation, so sorry if this is a duplicate, I'm just trying to figure it out.
You can find my code here. The main script is Deeper.py, just to save time.
If you notice in your repo, you have a Deeper.pyc and Deeper.py. If I run Deeper.py, it raises the same exception as yours. If I run Deeper.pyc, it raises another exception:
Traceback (most recent call last):
File "Deeper.py", line 7, in <module>
ToolbarTile = pygame.image.load("ToolbarTile.png")
pygame.error: Couldn't open Toolbar Tile.png
So, the code (bytecode, some previous version) references ToolbarTile.png, but the exception is about Toolbar Tile.png (with a space). So I changed the file name to account for that.
Now it raises:
Traceback (most recent call last):
File "Deeper.py", line 766, in <module>
else:
File "Deeper.py", line 394, in __init__
def displayCraft(self):
pygame.error: Couldn't open options.png
There's an Options.png in your files, but it looks for options.png (lower case) (even your new code in Deeper.py looks for that). So I changed that.
Now it works, albeit with Deeper.pyc so that must be why you thought:
(The file has been loaded, I've double-checked that.)
Maybe delete the Deeper.pyc and do a git-bisect to see when the bug was introduced (ps: check your toolbar.dat, does it seem okay to you? Also check the way you're using pickle.load. Maybe you should use rb instead of r?)
I am starting with Microsoft Azure SDK for Python (https://github.com/Azure/azure-sdk-for-python), but I have problems.
I am using Scientific Linux and I have installed the SDK for Python 3.4 following the next steps:
(instead of the SDK directory)
python setup.py install
after that I created a simple script just to test the connection:
from azure.storage import BlobService
blob_service = BlobService(account_name='thename', account_key='Mxxxxxxx3w==' )
blob_service.create_container('testcontainer')
for i in blob_service.list_containers():
print(i.name)
following this documentation:
http://blogs.msdn.com/b/tconte/archive/2013/04/17/how-to-interact-with-windows-azure-blob-storage-from-linux-using-python.aspx
http://azure.microsoft.com/en-us/documentation/articles/storage-python-how-to-use-blob-storage/#large-blobs
but is not working, I always receive the same error:
python3 test.py
Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/storageclient.py", line 143, in _perform_request
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/storageclient.py", line 132, in _perform_request_worker
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/http/httpclient.py", line 247, in perform_request
azure.http.HTTPError: The value for one of the HTTP headers is not in the correct format.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 21, in <module>
blob_service.create_container('testcontainer')
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/blobservice.py", line 192, in create_container
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/__init__.py", line 905, in _dont_fail_on_exist
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/blobservice.py", line 189, in create_container
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/storageclient.py", line 150, in _perform_request
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/__init__.py", line 889, in _storage_error_handler
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/__init__.py", line 929, in _general_error_handler
azure.WindowsAzureError: Unknown error (The value for one of the HTTP headers is not in the correct format.)
<?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidHeaderValue</Code><Message>The value for one of the HTTP headers is not in the correct format.
RequestId:b37c5584-0001-002b-24b8-c2c245000000
Time:2014-11-19T14:54:38.9378626Z</Message><HeaderName>x-ms-version</HeaderName><HeaderValue>2012-02-12</HeaderValue></Error>
Thanks in advance and best regards.
I have this exact same issue. I believe it's a library bug, but the author/s haven't had their say yet.
It looks like the response states the version, but it's actually giving you the header that's wrong. Its value should be "2014-02-14", you can do the fix shown in https://github.com/Azure/azure-sdk-for-python/pull/289 .
Hopefully this will be fixed and nobody will ever read this answer. Cheers!