Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Discord.py problems
-
Hi, I originally downloaded pythonista to develop a discord bot. But, everytime I do the following code I get errors:
import discord from discord.ext.commands import Bot from discord.ext import commands
I get the following errors: no module named “discord.ext”; “discord is not a package.
-
Is the file with your code called
discord.py
perhaps? If so, you need to rename it - otherwise when you sayimport discord
, it will import your own script instead of thediscord
module.Also just FYI, it's not possible to have a Python script run while Pythonista is in the background - iOS does not allow apps to run in the background for a long time. I don't know anything about writing Discord bots, but I assume that you have to keep your script running in order for the bot to work. So if you want your bot to always run, without having to start it manually first, you're probably better off running it on a regular computer instead of a mobile device.
-
@dgelessus Yes, I have renamed the file to my_bot.py from discord.py, I was unaware. I now have a new error:
No module named ctypes.macholib
-
Google is your friend:
https://github.com/omz/Pythonista-Issues/issues/311