openshot-render crash with "AttributeError: 'NoneType' object has no attribute 'settings'"

Bug #729359 reported by bwashed on 2011-03-04
56
This bug affects 10 people
Affects Status Importance Assigned to Milestone
OpenShot Video Editor
High
Unassigned

Bug Description

When trying to render a project with openshot-render it crashes with AttributeError. The project.form attribute, which seems to be a reference to a GTK form, is never set when running from openshot-render.

I was extremely happy to find the render-tool, as I've spent days trying to figure out a way to do a big batch job. Not so happy when I realised it didn't work. ;)

1) Ubuntu 10.10 (Also on 10.04)
2) Installed from repositories
3) Openshot-version 1.3.0

OUTPUT:

$openshot-render proj.osp

rendering options:
container type: avi
video codec: mpeg4
video bitrate: 5000000

audio codec: libmp3lame
audio sample rate: 44100
channels: 2
audio bitrate: 128000

Traceback (most recent call last):
  File "/usr/bin/openshot-render", line 58, in <module>
    main()
  File "/usr/lib/pymodules/python2.6/openshot/openshot_render.py", line 37, in main
    bot.render()
  File "/usr/lib/pymodules/python2.6/openshot/classes/cli_render.py", line 239, in render
    self.current_project.GenerateXML(os.path.join(self.USER_DIR, "sequence.mlt"))
  File "/usr/lib/pymodules/python2.6/openshot/classes/project.py", line 258, in GenerateXML
    self.sequences[0].GenerateXML(dom, tractor1)
  File "/usr/lib/pymodules/python2.6/openshot/classes/sequences.py", line 226, in GenerateXML
    bg_track.GenerateXML(dom, multitrack, fps=fps)
  File "/usr/lib/pymodules/python2.6/openshot/classes/track.py", line 110, in GenerateXML
    current_frame = MyClip.GenerateXML(dom, playlist, current_frame, fps=fps)
  File "/usr/lib/pymodules/python2.6/openshot/classes/clip.py", line 466, in GenerateXML
    use_affine = self.parent.parent.project.form.settings.general["use_affine"]
AttributeError: 'NoneType' object has no attribute 'settings'

moimael (moimael) on 2011-03-04
Changed in openshot:
status: New → Incomplete
status: Incomplete → Confirmed
importance: Undecided → High
moimael (moimael) wrote :

It seems to be quite complex to solve. A workaround could be to disable affine transformation for openshot_render, but the best solution would be to have a settings class which is ui independant, which is not the case now.

Maybe a good reason to use GSettings (it's mutli-platforms with windows, kde, and many others backend) ?

Emelar (martin-rothbaum) wrote :

As a temporary work-around, I've attached a simple patch that disables affine processing if self.parent.parent.project.form is None (ie: we're in command line mode).

tags: added: patch
Changed in openshot:
milestone: none → 1.4.0

a solution could be to add an option to openshot-render command to allow the use of affine processing to be turned on, this could set use_affine to "Yes" if chosen by user and leave it disabled by default.
I am the one that coded the command-line render, but I've been away from openshot for a long time, and I'm not sure I could tweak the code myself now, things have changed a lot meanwhile

Changed in openshot:
milestone: 1.4.0 → 1.4.1
Jonathan Thomas (jonoomph) wrote :

Hi everyone. Just a thought: Should openshot-render be removed eventually, since it is used very little by most users, and MLT's "melt" command-line can automate batch processing already? Please share your thoughts on the subject. Thanks.

bwashed (kjartan-hoie) wrote :

A wiki/manual page with 'Tips and trick on how to automate Openshot rendering' might be just as good use of resources in my opinion. If MLT "melt" does the job, then fixing/maintaining openshot-render feels a bit like duplicated effort. Also the effort put into documenting how to use the melt tool from a openshot perspective might strengthen the Openshot-MLT connection and also help the MLT project by itself.

The background for this particular bug-report was a a research project, where for each of 50 participants we had 2x5 one-minute video clips that needed to be stitched together side by side into one 5 minute clips. We got around the bug by letting the script (for each participant) set up a symbolic link for the video folder it started Openshot with a predefined project. It was a bit clunky since I then had to manually start the rendering in the Openshot UI and come back later to close openshot for the script to continue, but it wasn't worth putting more effort into automating it. (Actually, we needed one-minute side-by side clips in stead of five minute ones, but doing that directly in openshot with our procedure would mean opening up and closing Openshot 5x50 times.. The script used ffmpeg to cut the five-minute clips into one-minute clips afterwards).

As for our research project, we won't change our procedure now even if openshot-render gets fixed. Just using Openshot directly as described above works just fine.

Changed in openshot:
milestone: 1.4.1 → 1.5.0
James Marc (jasmerik) wrote :

I really like the graphical user interface for editing video, however exporting the project to a DVD format is killing my system resources on my laptop. I would love to be able to leave the heavy lifting on the export to my main desktop and be able to automate the exporting of multiple projects sequentially without my involvement (i.e. I've got twenty or thirty 4 hour projects that I'd like to be able to let run while I'm at the office or sleeping without having to start a new export only when I'm at the house). Also, I haven't been able to get the openshot-render working. I'm having the same problem as moimael above, but I couldn't figure out how to implement his patch to get mine working. (I tried pasting the text into the clip.py file but I'm still getting errors).

Any help on either getting openshot-render working, or some good tips on how to use something else to automate this process at the command line would be greatly appreciated.

Mr. Thomas - Bravo on a great product by the way! I had never done any video editing two weeks ago and now I'm breezing through it. Openshot has been excellent.

Changed in openshot:
milestone: 1.5.0 → 1.4.3
Changed in openshot:
milestone: 1.4.3 → 1.5.0

FWIW, I would also be sad if openshot-render disappeared. My use case:
- my wife does editing during the day
- I render the files overnight, as full HD video takes really long to encode

using openshot-render lets us batch the rendering.

Does melt read openshot project files?

Andy Finch (fincha) wrote :

No, but you can export xml from OpenShot that melt will read - use the File>Export XML menu item.

dsmurl (z3334) wrote :

I get this bug too and can't get the patch working. But I do like opwnshot-render.

Maybe OpenShot-render can just do the export to XML and then call melt internally instead of doing so much itself. But openshot-render is important because it is the batch functionality of openshot and needs to be maintained in my opinion because openshot relying on users to directly understand and use melt makes it a non-ubiquitous product or a nebulous mass of video editing softwares. Currently Openshot is a program that allows complete control of it's functionality from within it's own install and when you add things like blender, they are just used in the background. That a more wholesome include of functionality.

And exporting the XML file to go through melt is less useful to because you have to go into openshot to pull out a projects XML and that requirement breaks large scale nightly batch operations that people have chroned or scripted out.

I think it would be cool to have a project property some how like "add to nightly batch", with some simple profile editors that could go along with the batch entry, and a batch menu that can allow for nightly timing.

- Dsmurl

dsmurl (z3334) wrote :

I have clip.py in several places:

locate clip.py
/usr/lib/blender/scripts/startup/bl_operators/clip.py
/usr/lib/blender/scripts/startup/bl_ui/space_clip.py
/usr/lib/pymodules/python2.7/openshot/classes/clip.py
/usr/lib/pymodules/python2.7/openshot/classes/clip.pyc
/usr/share/pyshared/openshot/classes/clip.py

Can't figure out which one to change.

On Mon, Dec 03, 2012 at 04:20:17PM -0000, dsmurl wrote:
> I have clip.py in several places:
>
> locate clip.py
> /usr/lib/blender/scripts/startup/bl_operators/clip.py
> /usr/lib/blender/scripts/startup/bl_ui/space_clip.py
> /usr/lib/pymodules/python2.7/openshot/classes/clip.py
> /usr/lib/pymodules/python2.7/openshot/classes/clip.pyc
> /usr/share/pyshared/openshot/classes/clip.py
>
>
> Can't figure out which one to change.

This one:
/usr/share/pyshared/openshot/classes/clip.py

The first two ones are from blender, not openshot.
The third one is a symlink.
The fourth one is a byte-compiled version of the third one.

--
Marcin Owsiany <email address hidden> http://marcin.owsiany.pl/
GnuPG: 2048R/02F946FC 35E9 1344 9F77 5F43 13DD 6423 DBF4 80C6 02F9 46FC

"Every program in development at MIT expands until it can read mail."
                                                              -- Unknown

dsmurl (z3334) wrote :

Hm thanks, but I still can't get the patch to apply. I'm running 1.4.3. What am I doing wrong? I get

dsmurl@aqua /usr/share/pyshared/openshot/classes $ sudo patch -p0 <clip.py.patch
patching file clip.py
Hunk #1 FAILED at 463.
Hunk #2 FAILED at 767.
2 out of 2 hunks FAILED -- saving rejects to file clip.py.rej

I'm new to patches so please bare with me.

attached is rej file

Thanks,
Sam

On Wed, Dec 05, 2012 at 09:34:55AM -0000, dsmurl wrote:
> Hm thanks, but I still can't get the patch to apply. I'm running 1.4.3.
> What am I doing wrong? I get

Looks like I created the patch the wrong way :-)
But I thought "patch" would detect that and propose reversing the
order...

Try:

sudo patch -R /usr/share/pyshared/openshot/classes/clip.py < clip.py.patch

If that does not work, and the md5sum of your original clip.py file is
different than f5709574182f6528cdb6f189193ec540 please attach or send it
to me directly.

--
Marcin Owsiany <email address hidden> http://marcin.owsiany.pl/
GnuPG: 2048R/02F946FC 35E9 1344 9F77 5F43 13DD 6423 DBF4 80C6 02F9 46FC

"Every program in development at MIT expands until it can read mail."
                                                              -- Unknown

dsmurl (z3334) wrote :

It blows my mind that you guys are responding. Thanks. It didn't work. Attached is a copy of my clip.py. Just to let you know my

uname -a = sudo patch -R /usr/share/pyshared/openshot/classes/clip.py < clip.py.patch

distro = Mint 13 Mate (based off Ubuntu 12)

OpenShot = 1.4.3

- Happy Christmas

dsmurl (z3334) wrote :

I ment

uname -a = Linux aqua 3.2.0-33-generic #52-Ubuntu SMP Thu Oct 18 16:19:45 UTC 2012 i686 i686 i386 GNU/Linux

Attaching a corrected patch for 1.4.3. The previous one was created in the wrong direction.
Apply with:
sudo patch /usr/share/pyshared/openshot/classes/clip.py < clip.py.patch

dsmurl, try the patch I just uploaded. I've verified that it applies correctly to your clip.py (which is the same as mine, BTW).

If you still have problems applying, post the exact output of the following, ran one after another:

md5sum clip.py.patch
md5sum /usr/share/pyshared/openshot/classes/clip.py
sudo patch /usr/share/pyshared/openshot/classes/clip.py < clip.py.patch

Gregory Weber (spottedmetal) wrote :

Aha, now I know what that "Export XML" command is for!

Here are my thoughts on giving up openshot-render in favor of melt:

1. Giving up openshot-render right now is like giving up nothing, since it does not work.

2. The export XML command offers to save in my "Desktop" folder, which requires me to take extra steps to select the right location.

3. melt's documentation (http://www.mltframework.org/bin/view/MLT/MltMelt) is obscure, compared to the output of `openshot-render --help`, but I was able to figure out an example that works for what I want to do:

    $ melt -consumer avformat:OUTPUTFILE.webm frequency=24000 channels=1 threads=2 PROJECTFILE.mlt

(avformat selects avconv (or ffmpeg), frequency and channels are for the audio, and threads enables it to run on two processors; container format and video codec are implied by the output file extension, I think.)

4. It would be helpful to have a command-line tool to export an OpenShot project as Melt XML, and use it in a script which then runs melt to do the video rendering.

In fact, I would like to suggest, if you decide to dump openshot-render, replace it with two command-line tools: one to export an OpenShot project to Melt XML, and one to run melt to do the rendering but with the same command-line options as openshot-render (because they are relatively easy to figure out, from --help and from inspecting what you do in the OpenShot render dialog).

On Sun, Jan 06, 2013 at 02:14:55AM -0000, Gregory Weber wrote:
> Aha, now I know what that "Export XML" command is for!
>
> Here are my thoughts on giving up openshot-render in favor of melt:
>
> 1. Giving up openshot-render right now is like giving up nothing, since
> it does not work.

Well, it does with the patch! Though most users probably don't know
about it...

--
Marcin Owsiany <email address hidden> http://marcin.owsiany.pl/
GnuPG: 2048R/02F946FC 35E9 1344 9F77 5F43 13DD 6423 DBF4 80C6 02F9 46FC

"Every program in development at MIT expands until it can read mail."
                                                              -- Unknown

Gregory Weber (spottedmetal) wrote :

Marcin Owsiany wrote:

"Well, it does with the patch! Though most users probably don't know about it..."

I was aware, but was reluctant to apply the patch for a few reasons:

1. My md5sum for clip.py does not match the one originally advertised. However, I see now that it does match the clip.py in comment #15, so the patch in #17 should be good.

2. I don't recall clearly whether it is necessary to "compile" the patched clip.py to clip.pyc, or how to do it.

3. Concerned that I will have to apply the patch again when I get the next several upgraded versions of OpenShot. Some form of patch has been around since 2011-04-25, but instead of getting applied to the source "upstream" from where I stand, the milestone keeps creeping higher and higher.

I may have to try the patch anyway, since my latest effort using melt to render changed the video resolution from 1120x736 to 720x567, changed the frame rate from 15 fps to 25 fps, changed the duration from 16 minutes to 9 minutes (proportional to the frame rate change, I think, and cutting off the last 7 minutes).

On Sun, Jan 06, 2013 at 08:37:32PM -0000, Gregory Weber wrote:
> 2. I don't recall clearly whether it is necessary to "compile" the
> patched clip.py to clip.pyc, or how to do it.

Python should detect that .py is newer than .pyc and will ignore the
.pyc and byte-compile the .py on the fly. If it has write access to the
.pyc (and probably to the containing directory too), it will update it
as well.

--
Marcin Owsiany <email address hidden> http://marcin.owsiany.pl/
GnuPG: 2048R/02F946FC 35E9 1344 9F77 5F43 13DD 6423 DBF4 80C6 02F9 46FC

"Every program in development at MIT expands until it can read mail."
                                                              -- Unknown

Gregory Weber (spottedmetal) wrote :

Okay, I've applied the patch, and it now works to the extent of rendering the file and then "hanging" when done. This raises my interest in Bug #643151.

Gregory Weber (spottedmetal) wrote :

Ah, good -- thanks!

On Sun, Jan 6, 2013 at 4:33 PM, Marcin Owsiany <email address hidden> wrote:
> On Sun, Jan 06, 2013 at 08:37:32PM -0000, Gregory Weber wrote:
>> 2. I don't recall clearly whether it is necessary to "compile" the
>> patched clip.py to clip.pyc, or how to do it.
>
> Python should detect that .py is newer than .pyc and will ignore the
> .pyc and byte-compile the .py on the fly. If it has write access to the
> .pyc (and probably to the containing directory too), it will update it
> as well.
>
> --
> Marcin Owsiany <email address hidden> http://marcin.owsiany.pl/
> GnuPG: 2048R/02F946FC 35E9 1344 9F77 5F43 13DD 6423 DBF4 80C6 02F9 46FC
>
> "Every program in development at MIT expands until it can read mail."
> -- Unknown
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/729359
>
> Title:
> openshot-render crash with "AttributeError: 'NoneType' object has no
> attribute 'settings'"
>
> Status in OpenShot Video Editor:
> Confirmed
>
> Bug description:
> When trying to render a project with openshot-render it crashes with
> AttributeError. The project.form attribute, which seems to be a
> reference to a GTK form, is never set when running from openshot-
> render.
>
> I was extremely happy to find the render-tool, as I've spent days
> trying to figure out a way to do a big batch job. Not so happy when I
> realised it didn't work. ;)
>
> 1) Ubuntu 10.10 (Also on 10.04)
> 2) Installed from repositories
> 3) Openshot-version 1.3.0
>
>
> OUTPUT:
>
> $openshot-render proj.osp
>
> rendering options:
> container type: avi
> video codec: mpeg4
> video bitrate: 5000000
>
> audio codec: libmp3lame
> audio sample rate: 44100
> channels: 2
> audio bitrate: 128000
>
> Traceback (most recent call last):
> File "/usr/bin/openshot-render", line 58, in <module>
> main()
> File "/usr/lib/pymodules/python2.6/openshot/openshot_render.py", line 37, in main
> bot.render()
> File "/usr/lib/pymodules/python2.6/openshot/classes/cli_render.py", line 239, in render
> self.current_project.GenerateXML(os.path.join(self.USER_DIR, "sequence.mlt"))
> File "/usr/lib/pymodules/python2.6/openshot/classes/project.py", line 258, in GenerateXML
> self.sequences[0].GenerateXML(dom, tractor1)
> File "/usr/lib/pymodules/python2.6/openshot/classes/sequences.py", line 226, in GenerateXML
> bg_track.GenerateXML(dom, multitrack, fps=fps)
> File "/usr/lib/pymodules/python2.6/openshot/classes/track.py", line 110, in GenerateXML
> current_frame = MyClip.GenerateXML(dom, playlist, current_frame, fps=fps)
> File "/usr/lib/pymodules/python2.6/openshot/classes/clip.py", line 466, in GenerateXML
> use_affine = self.parent.parent.project.form.settings.general["use_affine"]
> AttributeError: 'NoneType' object has no attribute 'settings'
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/openshot/+bug/729359/+subscriptions

dsmurl (z3334) wrote :

I finally got around to testing the patch and it works with my version 1.4.3. Now I get the hanging error and I can't figure out how to apply that patch. :/

So, just to discribe my situation. I have about 20 projects that I'm working on and I'll have more in the future. I need to render each one into two formats. One for youtube and one for DVD. Is there a way to set up a script that will render it to one format and then render it to the other format and then go to the next video? I think the way that it's rendering now, it just renders to file into the default profile that was selected when the project was created. Is there a openshot-render option to render the project in a specific profile?

Also, the hang bug is getting me good on this. I can't find any dates for 1.5.0 which may have some of these fixes.

Is there a melt solution to my workflow?

Thanks for your help. I'm throwing you guys a thanks in the end of each of my videos by the way to throw some users in your direction.

- Sam

bf3000 (b-f3000) wrote :

Windows 10 x64 Build 14257.rs1
Openshot 2.0.6

And guess what?
I had the same bug twice today.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers