diff options
author | Ed Summers <[email protected]> | 2017-04-09 17:56:28 -0400 |
---|---|---|
committer | Ed Summers <[email protected]> | 2017-04-09 17:58:46 -0400 |
commit | c45a1af5e1f95f80245cfc8def01dc786362956a (patch) | |
tree | a6745736ca5dd20ea6fef52c13d6a15604499bf1 | |
parent | 853ae97dccc91988874ae229e9977c8f41a02e44 (diff) | |
download | mastodon.py-c45a1af5e1f95f80245cfc8def01dc786362956a.tar.gz |
fix ValueError
checking if media_type is defined will short circuit the
the call to os.path.isfile when content is supplied
fixes #28
-rw-r--r-- | mastodon/Mastodon.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 9967bdb..1ae888d 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -565,7 +565,7 @@ class Mastodon: | |||
565 | Returns a media dict. This contains the id that can be used in | 565 | Returns a media dict. This contains the id that can be used in |
566 | status_post to attach the media file to a toot. | 566 | status_post to attach the media file to a toot. |
567 | """ | 567 | """ |
568 | if os.path.isfile(media_file) and mime_type == None: | 568 | if mime_type == None and os.path.isfile(media_file): |
569 | mime_type = mimetypes.guess_type(media_file)[0] | 569 | mime_type = mimetypes.guess_type(media_file)[0] |
570 | media_file = open(media_file, 'rb') | 570 | media_file = open(media_file, 'rb') |
571 | 571 | ||