Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'imp' #44

Open
Schenk0 opened this issue Nov 17, 2023 · 4 comments
Open

ModuleNotFoundError: No module named 'imp' #44

Schenk0 opened this issue Nov 17, 2023 · 4 comments

Comments

@Schenk0
Copy link

Schenk0 commented Nov 17, 2023

Webex Bot version: ??? newest (just ran pipenv install webex_bot)
Python version: 3.12.0
Operating System: Windows 10

So I'm trying to get a simple Webex bot running and I am following this tutorial: https://www.youtube.com/watch?v=pC_hj2-czlk
but every time I run python app.py (the driver script) I get the ModuleNotFoundError: No module named 'imp' here is all of my code:

app.py:

from gpt import gpt
from webex_bot.webex_bot import WebexBot

#Create a Bot Object
bot = WebexBot("MY_WebEx_Bot_Access_Token")

#Clear default help command
bot.commands.clear()

#Add new commands for the bot to listen out for.
bot.add_command(gpt())

#Set new command as default
bot.help_command = gpt()

#Call `run` for the bot to wait for incoming messages.
bot.run()

gpt.py:

from webex_bot.models.response import Response

class gpt(Command):

    def __init__(self):
        super().__init__()
    
    def execute(self, message, attachment_actions, activity):
        
        return "Hello World!"

What am I doing wrong?

Here is the full error:

PS C:\Users\Bruger\Desktop\WebExBotTest2> python app.py
Traceback (most recent call last):
  File "C:\Users\Bruger\Desktop\WebExBotTest2\app.py", line 1, in <module>
    from gpt import gpt
  File "C:\Users\Bruger\Desktop\WebExBotTest2\gpt.py", line 3, in <module>
    from webex_bot.models.response import Response
  File "C:\Users\Bruger\.virtualenvs\WebExBotTest2-GkhwRhsf\Lib\site-packages\webex_bot\models\response.py", line 3, in <module>
    from webexteamssdk.models.cards import AdaptiveCard
  File "C:\Users\Bruger\.virtualenvs\WebExBotTest2-GkhwRhsf\Lib\site-packages\webexteamssdk\__init__.py", line 40, in <module>
    from .api import WebexTeamsAPI
  File "C:\Users\Bruger\.virtualenvs\WebExBotTest2-GkhwRhsf\Lib\site-packages\webexteamssdk\api\__init__.py", line 33, in <module>
    from webexteamssdk.models.immutable import immutable_data_factory
  File "C:\Users\Bruger\.virtualenvs\WebExBotTest2-GkhwRhsf\Lib\site-packages\webexteamssdk\models\immutable.py", line 42, in <module>
    from webexteamssdk.utils import json_dict
  File "C:\Users\Bruger\.virtualenvs\WebExBotTest2-GkhwRhsf\Lib\site-packages\webexteamssdk\utils.py", line 33, in <module>
    from future import standard_library
  File "C:\Users\Bruger\.virtualenvs\WebExBotTest2-GkhwRhsf\Lib\site-packages\future\standard_library\__init__.py", line 65, in <module>
    import imp
ModuleNotFoundError: No module named 'imp'
@gconklin
Copy link
Contributor

gconklin commented Nov 17, 2023

Hi @Schenk0 - you're using Python 3.12, which removed the imp lib (https://docs.python.org/3.12/whatsnew/3.12.html#imp)

There is an open issue to address this in the python-future library (PythonCharmers/python-future#488)

For now I would say use 3.11

@Schenk0
Copy link
Author

Schenk0 commented Nov 17, 2023

yeah, I realized that, but now I can't get the python to show up, but that's probably not an issue to discuss here...

And thanks for the quick response : D

@Schenk0 Schenk0 closed this as completed Nov 17, 2023
@gconklin
Copy link
Contributor

Hm, assuming the code you posted above has not changed much, it may be related to issue #41.
I tried your code above with my bot token and it did work for me.

@Schenk0
Copy link
Author

Schenk0 commented Nov 17, 2023

So the issue can be

  1. I'm behind a proxy
  2. ???

I have no idea what fixes I can try, I just created a new bot still have the same issue.
One note I have is that I can't message the bot directly at first. It says it can't find any user with that username. I have to add it to a space, then after that send it a direct message, don't know if that has anything to do with it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants