jarrodnorwell / InstaPy2

Instagram automation tool for farming comments, follows and likes, written in Python
GNU General Public License v3.0
52 stars 9 forks source link

AttributeError: 'MediaUtility' object has no attribute 'configuration' #29

Closed Max-cmd-dot closed 1 year ago

Max-cmd-dot commented 1 year ago

Hi, I have taken the standard example file for likes. And got the following error:

Traceback (most recent call last): File "c:\Users\adminuser\Desktop\instapytest.py", line 7, in <module> session.like(amount=10, iterable=['christmas'], type=LikeType.Tags) File "C:\Users\adminuser\AppData\Local\Programs\Python\Python310\lib\site-packages\instapy2\instapy2.py", line 232, in like medias = self.configuration.media.medias_tag(amount=amount, tag=tag, randomize_media=randomize_media, skip_top=skip_top) File "C:\Users\adminuser\AppData\Local\Programs\Python\Python310\lib\site-packages\instapy2\utilities\media.py", line 58, in medias_tag medias += [media for media in self.session.hashtag_medias_recent(name=tag, amount=amount) if not any(username in media.user.username for username in self.configuration.people.users_to_skip)] File "C:\Users\adminuser\AppData\Local\Programs\Python\Python310\lib\site-packages\instapy2\utilities\media.py", line 58, in <listcomp> medias += [media for media in self.session.hashtag_medias_recent(name=tag, amount=amount) if not any(username in media.user.username for username in self.configuration.people.users_to_skip)] AttributeError: 'MediaUtility' object has no attribute 'configuration'

I hope someone can help me fix the problem! Thanks

jarrodnorwell commented 1 year ago

Hey! Are you using the GitHub or PyPI version?

Max-cmd-dot commented 1 year ago

I use PyPI! Now I tried github instead and it worked, thanks!

jarrodnorwell commented 1 year ago

Could you try do git clone -b rework https://github.com/InstaPy2/InstaPy2 && pip install .\InstaPy2? It's the latest version available

Max-cmd-dot commented 1 year ago

After I install this as described above I get the following error thrown: Traceback (most recent call last): File "c:\Users\adminuser\Desktop\Insta_autom\AllInstabots\Instabot0.4\script_1\script_1.py", line 1, in <module> from instapy2 import InstaPy2 File "C:\Users\adminuser\AppData\Local\Programs\Python\Python310\lib\site-packages\instapy2\__init__.py", line 1, in <module> from .instapy2 import InstaPy2 File "C:\Users\adminuser\AppData\Local\Programs\Python\Python310\lib\site-packages\instapy2\instapy2.py", line 1, in <module> from .utilities import LoggerConstants, Utility File "C:\Users\adminuser\AppData\Local\Programs\Python\Python310\lib\site-packages\instapy2\utilities\__init__.py", line 1, in <module> from .logger import Logger, LoggerConstants File "C:\Users\adminuser\AppData\Local\Programs\Python\Python310\lib\site-packages\instapy2\utilities\logger.py", line 1, in <module> from enum import StrEnum ImportError: cannot import name 'StrEnum' from 'enum' (C:\Users\adminuser\AppData\Local\Programs\Python\Python310\lib\enum.py) Thanks for your help!

jarrodnorwell commented 1 year ago

StrEnum is only available in Python 3.11 so I'll need to do a check for that and change it for 3.9-10.

Max-cmd-dot commented 1 year ago

After updating python to the latest version and reinstalling pip, I get the following error: Traceback (most recent call last): File "c:\Users\adminuser\Desktop\InstaPy2\examples\like_tags.py", line 7, in <module> session.like(amount=10, iterable=['christmas'], type=LikeType.Tags) ^^^^^^^^^^^^^ File "C:\Users\adminuser\AppData\Local\Programs\Python\Python311\Lib\enum.py", line 786, in __getattr__ raise AttributeError(name) from None AttributeError: Tags Thanks so much!

jarrodnorwell commented 1 year ago

Unsure if you've imported it but if not you'll need from instapy2.types import LikeType and then you can use LikeType.HASHTAG

Max-cmd-dot commented 1 year ago

So i tryed this with this script: `from instapy2 import InstaPy2 from instapy2.types import LikeType

session = InstaPy2() session.login(username='', password='')

session.like(amount=10, iterable=['christmas'], type=LikeType.HASHTAG)`

And it returns: `Traceback (most recent call last): File "c:\Users\adminuser\Desktop\like_tags.py", line 7, in session.like(amount=10, iterable=['christmas'], type=LikeType.HASHTAG) File "C:\Users\adminuser\AppData\Local\Programs\Python\Python311\Lib\site-packages\instapy2\instapy2.py", line 66, in like identifiers = self.persistence.all_identifiers(table='medias_likes_hashtag') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\adminuser\AppData\Local\Programs\Python\Python311\Lib\site-packages\instapy2\utilities\persistence.py", line 24, in all_identifiers

tuples = cursor.execute(f'SELECT identifier from {table}').fetchall()
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sqlite3.OperationalError: no such table: medias_likes_hashtag`

jarrodnorwell commented 1 year ago

Interesting, I'll check that out a bit later tonight and try get an update out at the same time.

Max-cmd-dot commented 1 year ago

That would be very good, thank you! I noticed that with the main branch it works perfect. Still, despite VPN etc, I quickly get a login_required or "please wait a few minutes before you try again" after about 8 likes with instapy2.

Max-cmd-dot commented 1 year ago

I have seen the update and tried it. Using sqlite3 I can now see the table "medias_comments_hashtag and medias_likes_hashtag". However, I still get this error: Traceback (most recent call last): File "c:\Users\adminuser\Desktop\Insta_autom\liketest.py", line 7, in <module> session.like(amount=10, iterable=['christmas'], type=LikeType.HASHTAG) File "C:\Users\adminuser\AppData\Local\Programs\Python\Python311\Lib\site-packages\instapy2\instapy2.py", line 66, in like identifiers = self.persistence.all_identifiers(table='medias_likes_hashtag') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\adminuser\AppData\Local\Programs\Python\Python311\Lib\site-packages\instapy2\utilities\persistence.py", line 29, in all_identifiers tuples = cursor.execute(f"SELECT identifier from {table}").fetchall() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: no such column: identifier

jarrodnorwell commented 1 year ago

I did spam commit a few times, been a while since I've used Git through CLI.

I've just shut everything off for tonight (3am) but I'll look into that tomorrow. I've probably don't something wrong in the persistence file.