ohld / igbot

🐙 Free scripts, bots and Python API wrapper. Get free followers with our auto like, auto follow and other scripts!
https://hikerapi.com/p/N2P6iqiM
Apache License 2.0
4.71k stars 1.47k forks source link

upload_photo error #364

Closed heyton closed 6 years ago

heyton commented 7 years ago

Using this code in my upload_photo.py file

from instabot import Bot
bot = Bot()
bot.login()
path = "/Users/username/example.png"
text = "Hello!"
bot.upload_photo(path, text)

Got this error:

Traceback (most recent call last): File "upload_photo.py", line 12, in bot.upload_photo(path, text) File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 351, in upload_photo return upload_photo(self, photo, caption, upload_id) File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot_photo.py", line 9, in upload_photo if super(self.class, self).uploadPhoto(photo, caption, upload_id): File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 195, in uploadPhoto return uploadPhoto(self, photo, caption, upload_id) File "/usr/local/lib/python2.7/site-packages/instabot/api/api_photo.py", line 73, in uploadPhoto m = MultipartEncoder(data, boundary=self.uuid) File "/usr/local/lib/python2.7/site-packages/requests_toolbelt/multipart/encoder.py", line 119, in init self._prepare_parts() File "/usr/local/lib/python2.7/site-packages/requests_toolbelt/multipart/encoder.py", line 240, in _prepare_parts self.parts = [Part.from_field(f, enc) for f in self._iter_fields()] File "/usr/local/lib/python2.7/site-packages/requests_toolbelt/multipart/encoder.py", line 489, in from_field return cls(headers, body) File "/usr/local/lib/python2.7/site-packages/requests_toolbelt/multipart/encoder.py", line 482, in init self.len = len(self.headers) + total_len(self.body) TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

iamjagjeetubhi commented 7 years ago

Please try this!


from instabot import Bot 
bot = Bot()
bot.login()
path = "xyz.jpg"
text = "Hello!"
bot.uploadPhoto(path, text)
heyton commented 7 years ago

@iamjagjeetubhi get error

Traceback (most recent call last): File "upload_photo.py", line 10, in bot.upload_photo(path, text) File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot.py", line 351, in upload_photo return upload_photo(self, photo, caption, upload_id) File "/usr/local/lib/python2.7/site-packages/instabot/bot/bot_photo.py", line 9, in upload_photo if super(self.class, self).uploadPhoto(photo, caption, upload_id): File "/usr/local/lib/python2.7/site-packages/instabot/api/api.py", line 195, in uploadPhoto return uploadPhoto(self, photo, caption, upload_id) File "/usr/local/lib/python2.7/site-packages/instabot/api/api_photo.py", line 73, in uploadPhoto m = MultipartEncoder(data, boundary=self.uuid) File "/usr/local/lib/python2.7/site-packages/requests_toolbelt/multipart/encoder.py", line 119, in init self._prepare_parts() File "/usr/local/lib/python2.7/site-packages/requests_toolbelt/multipart/encoder.py", line 240, in _prepare_parts self.parts = [Part.from_field(f, enc) for f in self._iter_fields()] File "/usr/local/lib/python2.7/site-packages/requests_toolbelt/multipart/encoder.py", line 489, in from_field return cls(headers, body) File "/usr/local/lib/python2.7/site-packages/requests_toolbelt/multipart/encoder.py", line 482, in init self.len = len(self.headers) + total_len(self.body) TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

jensw83 commented 6 years ago

I have the same problem.

iamjagjeetubhi commented 6 years ago

I fixed it by: 1: $ pip uninstall instabot 2: $ pip install instabot==0.3.3.21

jensw83 commented 6 years ago

This solved the Problem. There seems to be a commit with a bug

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

sudoguy commented 6 years ago

Fixed in https://github.com/instagrambot/instabot/commit/a84ea4a6d2f97c1b19ed515ea01342eb0f1a4bc5