Vlc python binding - ctype error - python

I am trying to run the example file provided here : http://git.videolan.org/?p=vlc/bindings/python.git;a=tree;f=examples;hb=HEAD (the qtvlc example).
It gives me the following error :
$>c:\Python27_32b\python.exe examples_qtvlc.py "test_file.mov"
Traceback (most recent call last):
File "examples_qtvlc.py", line 114, in PlayPause
self.OpenFile()
File "examples_qtvlc.py", line 153, in OpenFile
self.MediaPlayer.set_hwnd(self.VideoFrame.winId())
File "vlc.py", line 2126, in set_hwnd
return libvlc_media_player_set_hwnd(self, drawable)
File "vlc.py", line 4263, in libvlc_media_player_set_hwnd
return f(p_mi, drawable)
ctypes.ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type
Traceback (most recent call last):
File "examples_qtvlc.py", line 192, in <module>
sys.exit(app.exec_())
It doesn't give me the error when I run the program, it gives it when I choose a .mov file from the "play" button in the interface.
Btw, if I try to play an .avi file it plays it, but in another window and it gives a "No accelerated IMDCT transform found".
The thing is I really need to be able to play .mov files, it is the only reason I am using the vlc module instead of Phonon available with PyQt.
I was having the same error when I tried to use the vlc module in my code so I thought I was doing something wrong. But if the example file is not working I guess there is something wrong in my config rather than my code. What can cause this error ?
EDIT :
I didn't notice, but if i click "play" again after choosing the file (and getting the error), the file does play... outside of the window.. The problem is that I don't have any control in this new window where the video plays.. What do I have to do to get it to play inside the application ?
The second thing is that I get the following error (repeating as the video plays)
[075e5654] main subpicture error: blending YUVA to J422 failed
I don't know if it important or not ...
SOLVED :
For those who would be interested, I casted the
self.VideoFrame.winId()
as an int and it seems to be doing what I want
Thanks for those who took the time to read this question..

Related

easygui buttonbox crashes becase of default font from Tkinter

I'm using easygui in a Python app and then generate an .exe with PyInstaller.
Everything works fine in my computer, but my colleague get this weird error when they try to run the app :
Traceback (most recent call last):
File "easygui\boxes\button_box.py", line 95, in buttonbox
File "easygui\boxes\button_box.py", line 147, in __init__
File "easygui\boxes\button_box.py", line 268, in __init__
File "tkinter\font.py", line 23, in nametofont
File "tkinter\font.py", line 86, in __init__
RuntimeError: main thread is not in main loop
The line where easygui is called is simply
choice = easygui.buttonbox(
"msg", "title", choices=["choice1", "choice2"],
default_choice="choice1", cancel_choice="choice2"
)
so the problem seems to be with the font but I'm not using anything particular in easygui ? I've searched for issues on the easygui's Git but couldn't find anything
Also, there was another easygui.buttonbox earlier in the process but this one did show up properly so I'm just really confused.
Thanks!
The solution was to show the msgbox in the main thread. It crashed because the msgbx was in a different thread than the main one

Did pyglet change recently?

So, The other day, I went back to an old project to finish it but when I tried running it, it gave me several errors that I've tried to fix but some of them I don't know how to fix. The program worked fine when I stopped working on it, so I'm very confused at what happened. My guess is that pyglet got a new update and removed a lot of stuff I used to use. Some of the errors I get are as follows
Traceback (most recent call last):
File "C:\Users\____\Desktop\Code\3D\Projects\3D Program 1\main.py", line 9,
in <module>
screen =
pyglet.window.get_platform().get_default_display().get_default_screen()
AttributeError: module 'pyglet.window' has no attribute 'get_platform'
and
Traceback (most recent call last):
File "C:\Users\____\Desktop\Code\3D\Projects\3D Program 1\main.py", line 216, in <module>
main()
File "C:\Users\____\Desktop\Code\3D\Projects\3D Program 1\main.py", line 208, in main
win = Window(caption = "3D Program 1", width = WINW, height = WINH, resizable = False, vsync = True)
File "C:\Users\____\Desktop\Code\3D\Projects\3D Program 1\main.py", line 57, in __init__
self.tex1 = get_tex("steel_tex.png")
File "C:\Users\____\Desktop\Code\3D\Projects\3D Program 1\main.py", line 21, in get_tex
tex = pyglet.image.load(file).texture
AttributeError: 'ImageData' object has no attribute 'texture'
I also had problems with it saying that there was no such thing as the "pyglet.graphics.TextureGroup" class
Yes, it looks like both of snippets of code you show are using features that were deprecated in previous versions of Pyglet and removed in the recent 1.4 release. You can see the deprecation (and their suggested replacements) in the documentation for older versions:
The get_platform() function in pyglet.window:
Deprecated. Use pyglet.canvas.Display.
The .texture attribute of an image:
Deprecated. Use get_texture().

Not able to add Text Clip in Moviepy. Getting error related to Imagemagic

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!

clicking "cancel" in tkColorChooser dialog leads to Error

I use python 2.6 under linux (SUSE Linux Enterprise Desktop 11 (x86_64)). I tested some very simple code :
import tkColorChooser
tkColorChooser.askcolor()
then if I click on cancel, I always get error like:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/lib-tk/tkColorChooser.py", line 62, in askcolor
return Chooser(**options).show()
File "/usr/lib64/python2.6/lib-tk/tkCommonDialog.py", line 50, in show
s = self._fixresult(w, s)
File "/usr/lib64/python2.6/lib-tk/tkColorChooser.py", line 48, in _fixresult
r, g, b = widget.winfo_rgb(result)
File "/usr/lib64/python2.6/lib-tk/Tkinter.py", line 786, in winfo_rgb
self.tk.call('winfo', 'rgb', self._w, color))
_tkinter.TclError: unknown color name ""
I have more complicated code using tkColorChooser, which gives same error if I click on cancel in the color chooser dialog. I think I can catch the error. But is tkColorChooser designed to be like this? Is there any other neater way to cope with this problem? Thanks!
Looking at the version of tkColorChooser.py I have (Python 2.6.4, Win32), it should support the user pressing cancel (as do and should the other predefined dialogs): it is indeed supposed to return None when the results evals to False in a boolean context.
Therefore, something strange is happening.
edit: as I noted in the comments, it is indeed a bug that has been fixed in version 2.6.2.

Problems using PyQt's Resource System

I am trying to use PyQt's Resource System but it appears I have no clue what I am doing! I already have to application created, along with its GUI I am just trying to import some images to use with the program.
I used the QtDesigner to create the resource file and I compiled it using pyrcc4.exe. But when I attempt to import the resource file I get this error:
Traceback (most recent call last):
File "C:\Projects\main.py", line 14, in <module>
import main_rc
File "C:\Projects\main_rc.py", line 482, in <module>
qInitResources()
File "C:\Projects\main_rc.py", line 477, in qInitResources
QtCore.qRegisterResourceData(0x01, qt_resource_struct, qt_resource_name, qt_resource_data)
TypeError: argument 2 of qRegisterResourceData() has an invalid type
What am I doing wrong?
pyrcc generates Python 2.x code by default.
Try regenerating your resource files using pyrcc with flag '-py3'

Categories

Resources