Skip to main content
etiquetas editadas
Enlace
FJSevilla
  • 62.1k
  • 7
  • 43
  • 68

No me deja SyntaxError al inentar importar la libreria de discord desde python

se añadieron 131 caracteres en el cuerpo; título editado
Origen Enlace

Can´t import No me deja importar la libreria de discord lib withdesde python

i m using python 3.7 and i can´t importestoy intentando hacer un bot de discord in this projecty me falla el import de la primera línea no sé por qué.

import discord
from discord.ext import commands
from discord.ext.commands import Bot

Cliente = discord.Client()
cliente = commands.Bot("!")

#Ping al bot
@discord.client.event
async def on_message(message):
    if message.content.startswith('!Hi'):
        await discord.client.send_message(message)
    pass
cliente.run('NTA3Njc5Nzc2OTc1MzU1OTI3.Dr2rZA.Kt5qjj7kBKundrrjDy8pGP_Tsmg')

Then i got the followingY me da este error:

/usr/bin/python3 /home/mario/PycharmProjects/Bot/Main.py
Traceback (most recent call last):
  File "/home/mario/PycharmProjects/Bot/Main.py", line 1, in <module>
    import discord
  File "/usr/lib/python3.7/site-packages/discord/__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "/usr/lib/python3.7/site-packages/discord/client.py", line 38, in <module>
    from .state import ConnectionState
  File "/usr/lib/python3.7/site-packages/discord/state.py", line 36, in <module>
    from . import utils, compat
  File "/usr/lib/python3.7/site-packages/discord/compat.py", line 32
    create_task = asyncio.async
                              ^
SyntaxError: invalid syntax

Thanks for the help :DHe leido que a veces pasando a la version anterior de python se solucionaba, lo he hecho y no me ha funcionado. Gracias por la ayuda

Can´t import discord lib with python

i m using python 3.7 and i can´t import discord in this project.

import discord
from discord.ext import commands
from discord.ext.commands import Bot

Cliente = discord.Client()
cliente = commands.Bot("!")

#Ping al bot
@discord.client.event
async def on_message(message):
    if message.content.startswith('!Hi'):
        await discord.client.send_message(message)
    pass
cliente.run('NTA3Njc5Nzc2OTc1MzU1OTI3.Dr2rZA.Kt5qjj7kBKundrrjDy8pGP_Tsmg')

Then i got the following error:

/usr/bin/python3 /home/mario/PycharmProjects/Bot/Main.py
Traceback (most recent call last):
  File "/home/mario/PycharmProjects/Bot/Main.py", line 1, in <module>
    import discord
  File "/usr/lib/python3.7/site-packages/discord/__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "/usr/lib/python3.7/site-packages/discord/client.py", line 38, in <module>
    from .state import ConnectionState
  File "/usr/lib/python3.7/site-packages/discord/state.py", line 36, in <module>
    from . import utils, compat
  File "/usr/lib/python3.7/site-packages/discord/compat.py", line 32
    create_task = asyncio.async
                              ^
SyntaxError: invalid syntax

Thanks for the help :D

No me deja importar la libreria de discord desde python

estoy intentando hacer un bot de discord y me falla el import de la primera línea no sé por qué.

import discord
from discord.ext import commands
from discord.ext.commands import Bot

Cliente = discord.Client()
cliente = commands.Bot("!")

#Ping al bot
@discord.client.event
async def on_message(message):
    if message.content.startswith('!Hi'):
        await discord.client.send_message(message)
    pass
cliente.run('NTA3Njc5Nzc2OTc1MzU1OTI3.Dr2rZA.Kt5qjj7kBKundrrjDy8pGP_Tsmg')

Y me da este error:

/usr/bin/python3 /home/mario/PycharmProjects/Bot/Main.py
Traceback (most recent call last):
  File "/home/mario/PycharmProjects/Bot/Main.py", line 1, in <module>
    import discord
  File "/usr/lib/python3.7/site-packages/discord/__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "/usr/lib/python3.7/site-packages/discord/client.py", line 38, in <module>
    from .state import ConnectionState
  File "/usr/lib/python3.7/site-packages/discord/state.py", line 36, in <module>
    from . import utils, compat
  File "/usr/lib/python3.7/site-packages/discord/compat.py", line 32
    create_task = asyncio.async
                              ^
SyntaxError: invalid syntax

He leido que a veces pasando a la version anterior de python se solucionaba, lo he hecho y no me ha funcionado. Gracias por la ayuda

Origen Enlace

Can´t import discord lib with python

i m using python 3.7 and i can´t import discord in this project.

import discord
from discord.ext import commands
from discord.ext.commands import Bot

Cliente = discord.Client()
cliente = commands.Bot("!")

#Ping al bot
@discord.client.event
async def on_message(message):
    if message.content.startswith('!Hi'):
        await discord.client.send_message(message)
    pass
cliente.run('NTA3Njc5Nzc2OTc1MzU1OTI3.Dr2rZA.Kt5qjj7kBKundrrjDy8pGP_Tsmg')

Then i got the following error:

/usr/bin/python3 /home/mario/PycharmProjects/Bot/Main.py
Traceback (most recent call last):
  File "/home/mario/PycharmProjects/Bot/Main.py", line 1, in <module>
    import discord
  File "/usr/lib/python3.7/site-packages/discord/__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "/usr/lib/python3.7/site-packages/discord/client.py", line 38, in <module>
    from .state import ConnectionState
  File "/usr/lib/python3.7/site-packages/discord/state.py", line 36, in <module>
    from . import utils, compat
  File "/usr/lib/python3.7/site-packages/discord/compat.py", line 32
    create_task = asyncio.async
                              ^
SyntaxError: invalid syntax

Thanks for the help :D