导入discord.py失败,出现语法错误

时间:2019-02-01 15:33:32

标签: python visual-studio-code discord discord.py

尝试导入discord.py失败,并出现语法错误。

我尝试导入numpy并导入自己的文件,它们都可以工作。我的代码和追溯信息如下。

import discord
import okonfig as okonfig

TOKEN = okonfig.getToken()

client = discord.Client()

# ... 

跟踪:

File "c:\Users\Larson Ashcroft\.vscode-exploration\extensions\ms-python.python-2019.1.0\pythonFiles\ptvsd_launcher.py", line 45, in <module>
    main(ptvsdArgs)
  File "c:\Users\Larson Ashcroft\.vscode-exploration\extensions\ms-python.python-2019.1.0\pythonFiles\lib\python\ptvsd\__main__.py", line 348, in main
    run()
  File "c:\Users\Larson Ashcroft\.vscode-exploration\extensions\ms-python.python-2019.1.0\pythonFiles\lib\python\ptvsd\__main__.py", line 253, in run_file
    runpy.run_path(target, run_name='__main__')
  File "C:\Users\Larson Ashcroft\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "C:\Users\Larson Ashcroft\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "C:\Users\Larson Ashcroft\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Users\Larson Ashcroft\Documents\GitHub\3.141bot\ok\ok.py", line 1, in <module>
    import discord
  File "C:\Users\Larson Ashcroft\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "C:\Users\Larson Ashcroft\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 38, in <module>
    from .state import ConnectionState
  File "C:\Users\Larson Ashcroft\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\state.py", line 36, in <module>
    from . import utils, compat
  File "C:\Users\Larson Ashcroft\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\compat.py", line 32
    create_task = asyncio.async
                              ^
SyntaxError: invalid syntax

预期结果:机器人连接并联机
实际结果:回溯错误(以上)

0 个答案:

没有答案