How can fix that error on poershell (py file)

384 views Asked by At

when i want to run an py file, it doesn't opened

look, it's a Instapy file, and when i already installed; py -3 -m pip install instapy and installed, buy when i want to run my file they told you have an error on " from instapy import InstaPy "

wait, when i put on powerShell;

PS C:\Users\miroc\Desktop\insta py> py instagram_bot.py

they say;

Traceback (most recent call last):
  File "C:\Users\miroc\Desktop\insta py\instagram_bot.py", line 1, in <module>
    from instapy import InstaPy
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\instapy\__init__.py", line 6, in <module>
    from .instapy import InstaPy
  File "C:\Python311\Lib\site-packages\instapy\instapy.py", line 34, in <module>
    from .browser import close_browser, set_selenium_local_session
  File "C:\Python311\Lib\site-packages\instapy\browser.py", line 14, in <module>
    from .util import interruption_handler
  File "C:\Python311\Lib\site-packages\instapy\util.py", line 27, in <module>
    from emoji.unicode_codes import UNICODE_EMOJI
ImportError: cannot import name 'UNICODE_EMOJI' from 'emoji.unicode_codes' (C:\Python311\Lib\site-packages\emoji\unicode_codes\__init__.py)

so what i can do to fix that error, btw i have been install InstaPy package file

2

There are 2 answers

2
RockYou On

Upgrade the emoji library to the latest version. You can do this by running the following command in your terminal or command prompt: "pip install --upgrade emoji"

-Uninstall the emoji library and reinstall it. You can do this by running the following command in your terminal or command prompt: "pip uninstall emoji" followed by "pip install emoji"

0
cuzi On

This is a known issue that was solved by this pull request. However a new version with the fix has not been released on pypi.org yet.

So the InstaPy version on pypi.org is not compatible with the latest version of the emoji package.

You need to either install an older version of the emoji package like so:

pip uninstall emoji
pip install emoji==1.6.3

Or you need to install InstaPy directly from the github repository which includes the fix:

pip uninstall instapy
pip install git+https://github.com/InstaPy/InstaPy

At the moment, InstaPy is not usable as far as I know. You should consider using InstaPy2 as a replacement for InstaPy.