运行示例python-telegram-bot代码时发生错误

时间:2019-08-16 16:41:12

标签: python python-3.x telegram telegram-bot python-telegram-bot

我正在运行一个示例python-telegram-bot,但出现以下错误:

错误:

import telegram

  File "C:\Users\Ramin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\python_telegram_bot-12.0.0b1-py3.6.egg\telegram\__init__.py", line 101, in <module>
  File "C:\Users\Ramin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\python_telegram_bot-12.0.0b1-py3.6.egg\telegram\bot.py", line 43, in <module>
  File "C:\Users\Ramin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\python_telegram_bot-12.0.0b1-py3.6.egg\telegram\utils\request.py", line 35, in <module>
ModuleNotFoundError: No module named 'telegram.vendor.ptb_urllib3'

1 个答案:

答案 0 :(得分:0)

ptb_urllib3是telegram-bot的子模块,您可以通过以下操作对其进行初始化:

This is what I got as output:
{
  'Entities': [
    {
      'Id': 7,
      'BeginOffset': 1,
      'EndOffset': 3,
      'Score': 0.9946974515914917,
      'Text': '60',
      'Category': 'PROTECTED_HEALTH_INFORMATION',
      'Type': 'AGE',
      'Traits': [

      ]
    },
    {
      'Id': 10,
      'BeginOffset': 31,
      'EndOffset': 35,
      'Score': 0.9719576835632324,
      'Text': 'T2DM',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'DIAGNOSIS',
          'Score': 0.9450973868370056
        }
      ]
    },
    {
      'Id': 11,
      'BeginOffset': 53,
      'EndOffset': 56,
      'Score': 0.7314696907997131,
      'Text': 'OHA',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'DIAGNOSIS',
          'Score': 0.5971980690956116
        }
      ]
    },
    {
      'Id': 12,
      'BeginOffset': 57,
      'EndOffset': 69,
      'Score': 0.9934116005897522,
      'Text': 'Hypertensive',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'DIAGNOSIS',
          'Score': 0.9471467733383179
        }
      ]
    },
    {
      'Id': 13,
      'BeginOffset': 79,
      'EndOffset': 82,
      'Score': 0.8657081127166748,
      'Text': 'IHD',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'DIAGNOSIS',
          'Score': 0.8929517269134521
        }
      ]
    },
    {
      'Id': 14,
      'BeginOffset': 87,
      'EndOffset': 96,
      'Score': 0.9757838845252991,
      'Text': 'Euthyroid',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'DIAGNOSIS',
          'Score': 0.9470660090446472
        }
      ]
    },
    {
      'Id': 0,
      'BeginOffset': 124,
      'EndOffset': 144,
      'Score': 0.6679201126098633,
      'Text': 'Homeopathy medicines',
      'Category': 'TEST_TREATMENT_PROCEDURE',
      'Type': 'TREATMENT_NAME',
      'Traits': [

      ]
    },
    {
      'Id': 15,
      'BeginOffset': 153,
      'EndOffset': 164,
      'Score': 0.5985288619995117,
      'Text': 'Haemorhoids',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'DIAGNOSIS',
          'Score': 0.6647800803184509
        }
      ]
    },
    {
      'Id': 16,
      'BeginOffset': 169,
      'EndOffset': 174,
      'Score': 0.9405372738838196,
      'Text': 'fever',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'DIAGNOSIS',
          'Score': 0.7457793354988098
        }
      ]
    },
    {
      'Id': 26,
      'BeginOffset': 179,
      'EndOffset': 189,
      'Score': 0.37402620911598206,
      'Text': 'Peripheral',
      'Category': 'ANATOMY',
      'Type': 'DIRECTION',
      'Traits': [

      ]
    },
    {
      'Id': 17,
      'BeginOffset': 179,
      'EndOffset': 200,
      'Score': 0.8868133425712585,
      'Text': 'Peripheral neuropathy',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'DIAGNOSIS',
          'Score': 0.9166043400764465
        }
      ]
    },
    {
      'Id': 27,
      'BeginOffset': 209,
      'EndOffset': 213,
      'Score': 0.6287723779678345,
      'Text': 'back',
      'Category': 'ANATOMY',
      'Type': 'SYSTEM_ORGAN_SITE',
      'Traits': [

      ]
    },
    {
      'Id': 9,
      'BeginOffset': 230,
      'EndOffset': 240,
      'Score': 0.9881155490875244,
      'Text': 'Pregabalin',
      'Category': 'MEDICATION',
      'Type': 'GENERIC_NAME',
      'Traits': [

      ]
    },
    {
      'Id': 8,
      'BeginOffset': 283,
      'EndOffset': 300,
      'Score': 0.9324891567230225,
      'Text': '1.3(11-11-16).Now',
      'Category': 'PROTECTED_HEALTH_INFORMATION',
      'Type': 'DATE',
      'Traits': [

      ]
    },
    {
      'Id': 1,
      'BeginOffset': 311,
      'EndOffset': 313,
      'Score': 0.42533111572265625,
      'Text': 'cr',
      'Category': 'TEST_TREATMENT_PROCEDURE',
      'Type': 'TEST_NAME',
      'Traits': [

      ],
      'Attributes': [
        {
          'Type': 'TEST_VALUE',
          'Score': 0.9705457091331482,
          'RelationshipScore': 1.0,
          'Id': 2,
          'BeginOffset': 325,
          'EndOffset': 329,
          'Text': '0.89',
          'Traits': [

          ]
        }
      ]
    },
    {
      'Id': 18,
      'BeginOffset': 354,
      'EndOffset': 366,
      'Score': 0.5006829500198364,
      'Text': 'Hepatomegaly',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [

      ]
    },
    {
      'Id': 19,
      'BeginOffset': 372,
      'EndOffset': 385,
      'Score': 0.6968429684638977,
      'Text': 'fatty changes',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'SIGN',
          'Score': 0.44842731952667236
        },
        {
          'Name': 'DIAGNOSIS',
          'Score': 0.628720223903656
        }
      ]
    },
    {
      'Id': 20,
      'BeginOffset': 386,
      'EndOffset': 400,
      'Score': 0.8746378421783447,
      'Text': 'cholelithiasis',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'DIAGNOSIS',
          'Score': 0.7521570324897766
        }
      ]
    },
    {
      'Id': 28,
      'BeginOffset': 422,
      'EndOffset': 430,
      'Score': 0.47990521788597107,
      'Text': 'Hairline',
      'Category': 'ANATOMY',
      'Type': 'SYSTEM_ORGAN_SITE',
      'Traits': [

      ]
    },
    {
      'Id': 21,
      'BeginOffset': 422,
      'EndOffset': 439,
      'Score': 0.584293782711029,
      'Text': 'Hairline fracture',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'DIAGNOSIS',
          'Score': 0.9427288770675659
        }
      ]
    },
    {
      'Id': 29,
      'BeginOffset': 440,
      'EndOffset': 445,
      'Score': 0.686669647693634,
      'Text': 'lower',
      'Category': 'ANATOMY',
      'Type': 'DIRECTION',
      'Traits': [

      ]
    },
    {
      'Id': 30,
      'BeginOffset': 453,
      'EndOffset': 459,
      'Score': 0.6198492646217346,
      'Text': 'radius',
      'Category': 'ANATOMY',
      'Type': 'SYSTEM_ORGAN_SITE',
      'Traits': [

      ]
    },
    {
      'Id': 3,
      'BeginOffset': 513,
      'EndOffset': 516,
      'Score': 0.9929847717285156,
      'Text': 'Cr.',
      'Category': 'TEST_TREATMENT_PROCEDURE',
      'Type': 'TEST_NAME',
      'Traits': [

      ],
      'Attributes': [
        {
          'Type': 'TEST_VALUE',
          'Score': 0.98384028673172,
          'RelationshipScore': 0.9999998807907104,
          'Id': 4,
          'BeginOffset': 517,
          'EndOffset': 521,
          'Text': '0.82',
          'Traits': [

          ]
        }
      ]
    },
    {
      'Id': 5,
      'BeginOffset': 522,
      'EndOffset': 526,
      'Score': 0.7047827839851379,
      'Text': 'prev',
      'Category': 'TEST_TREATMENT_PROCEDURE',
      'Type': 'TEST_NAME',
      'Traits': [

      ],
      'Attributes': [
        {
          'Type': 'TEST_VALUE',
          'Score': 0.9839150905609131,
          'RelationshipScore': 0.9999982118606567,
          'Id': 6,
          'BeginOffset': 527,
          'EndOffset': 531,
          'Text': '0.98',
          'Traits': [

          ]
        }
      ]
    },
    {
      'Id': 22,
      'BeginOffset': 542,
      'EndOffset': 554,
      'Score': 0.9988911747932434,
      'Text': 'constipation',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'SYMPTOM',
          'Score': 0.7921050786972046
        }
      ]
    },
    {
      'Id': 23,
      'BeginOffset': 556,
      'EndOffset': 572,
      'Score': 0.9752655625343323,
      'Text': 'cold intolerance',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'SYMPTOM',
          'Score': 0.9271456599235535
        }
      ]
    },
    {
      'Id': 24,
      'BeginOffset': 574,
      'EndOffset': 579,
      'Score': 0.8357191681861877,
      'Text': 'cough',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'SYMPTOM',
          'Score': 0.6976621747016907
        }
      ]
    },
    {
      'Id': 25,
      'BeginOffset': 600,
      'EndOffset': 608,
      'Score': 0.9620472192764282,
      'Text': 'sneezing',
      'Category': 'MEDICAL_CONDITION',
      'Type': 'DX_NAME',
      'Traits': [
        {
          'Name': 'SYMPTOM',
          'Score': 0.7259325385093689
        }
      ]
    }
  ],
  'UnmappedAttributes': [

  ],
  'ResponseMetadata': {
    'RequestId': '75b3311e-d8de-41e6-9335-907034f63c30',
    'HTTPStatusCode': 200,
    'HTTPHeaders': {
      'content-type': 'application/x-amz-json-1.1',
      'date': 'Thu, 15 Aug 2019 04:47:21 GMT',
      'x-amzn-requestid': '75b3311e-d8de-41e6-9335-907034f63c30',
      'content-length': '5516',
      'connection': 'keep-alive'
    },
    'RetryAttempts': 0
  }
}
相关问题