0

I am using pyrogram in a program but when i run the program it gives import error i uninstalled and reinstalled it but the problem is still there. I am not able to fix it i have tried the previous version as well as the new version but the problem is the same. Here is the output:

Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyrogram
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/__init__.py", line 40, in <module>
    from . import raw, types, filters, handlers, emoji
  File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/__init__.py", line 22, in <module>
    from .input_media import *
  File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/input_media/__init__.py", line 25, in <module>
    from .input_phone_contact import InputPhoneContact
  File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/input_media/input_phone_contact.py", line 20, in <module>
    from pyrogram.session.internals import MsgId
  File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/session/__init__.py", line 19, in <module>
    from .auth import Auth
  File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/session/auth.py", line 29, in <module>
    from pyrogram.crypto import aes, rsa, prime
  File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/crypto/prime.py", line 19, in <module>
    from random import randint
  File "/home/ak/Desktop/development/bots/pyrogramplugins/multiuserbot/final/random.py", line 1, in <module>
    from pyrogram import Client, filters, idle
  File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/filters.py", line 24, in <module>
    from pyrogram.types import Message, CallbackQuery, InlineQuery, InlineKeyboardMarkup, ReplyKeyboardMarkup, Update
ImportError: cannot import name 'Message' from partially initialized module 'pyrogram.types' (most likely due to a circular import) (/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/__init__.py)
>>> 

I am stuck here i have tried everything i know but not able to fix it

Akrash Nadeem
  • 96
  • 2
  • 11
  • 1
    Does this answer your question? https://stackoverflow.com/questions/64807163/importerror-cannot-import-name-from-partially-initialized-module-m – chickity china chinese chicken Dec 26 '21 at 08:25
  • thanks man i get it it is because of name i have givien to some file is the name of module – Akrash Nadeem Dec 26 '21 at 09:35
  • Does this answer your question? [ImportError: cannot import name '...' from partially initialized module '...' (most likely due to a circular import)](https://stackoverflow.com/questions/64807163/importerror-cannot-import-name-from-partially-initialized-module-m) – Mark Feb 11 '22 at 16:57

1 Answers1

1

It is because the file name is same as the module name which I am using in code. Change the file name and never give file a name which is the name of a module

Akrash Nadeem
  • 96
  • 2
  • 11