Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextClips can cause an Exception if the text argument starts with a '@' #56

Closed
djds23 opened this issue Aug 12, 2014 · 3 comments
Closed

Comments

@djds23
Copy link

djds23 commented Aug 12, 2014

I noticed making TextClips with twitter bodies that it would cause an exception to get raised:

Creating a TextClip with a body like this

@raymondh, list comprehensions are awesome!

it would raise an error like this:

TypeError: coercing to Unicode: need string or buffer, NoneType found

I believe the issue spawns at line 1175 of moviepy/video/VideoClip. The __init__checks if the text does not start with '@' and if it does not, then it creates a temporary file for. If it does start with '@' then no temporary file is created, and the exception is raised at line 1230 when an os.path.exists is called on the temptxt, which does not exist because of the check performed above! I am unsure what the initial check is there for, but I am pretty sure it is part of the issue. What is it checking for exactly? Is there a better way to perform this check than make sure the user input does not start with '@'?

Thanks for the awesome library zulko!

@djds23 djds23 changed the title TextClips can cause an error if the text argument starts with a '@' TextClips can cause an Exception if the text argument starts with a '@' Aug 12, 2014
@Zulko
Copy link
Owner

Zulko commented Aug 12, 2014

Thanks for the report, I didn't think about that... The "@" is here because of ImageMagick's syntax, it means "this is not a text, it indicates the name of file in which you must read the text". So I kept the same syntax for the Python function which calls ImageMagick... but indeed it's annoying if you want to write tweets.

I will correct it asap (I will remove the check for the '@' and provide a new argument for people who want to pass a filename as argument instead of text). So on your side if you are in a hurry replace this line "if not txt.startswith('@')" by "if True" and reinstall.

@djds23
Copy link
Author

djds23 commented Aug 12, 2014

Its alright, I have simply compensated for it in my own code by adding an empty space before the "@" which is quicker for me. Thanks for the speedy response.

@Zulko
Copy link
Owner

Zulko commented Aug 16, 2014

I think I fixed it now.

@Zulko Zulko closed this as completed Aug 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants