---
source_url: https://www.pubnub.com/docs/sdks/asyncio/troubleshoot
title: Troubleshooting Python-Asyncio SDK
updated_at: 2026-05-22T09:19:50.282Z
sdk_name: PubNub Python Asyncio SDK
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Troubleshooting Python-Asyncio SDK

PubNub Python Asyncio SDK

Install:

```bash
pip install pubnub
```

This page explains how to find the version of the PubNub Python-Asyncio Software Development Kit (SDK) and how to log it for troubleshooting and support.

## How to find the version of your SDK

Knowing your Software Development Kit (SDK) version helps with troubleshooting and reporting bugs. You can access the SDK version using the `SDK_VERSION` constant.

### Access your SDK version via constant

The following snippet demonstrates how to retrieve and display the SDK version using the `PubNubAsyncio` class.

### Steps to access the SDK version

1. Import the required modules.
2. Retrieve the version with `PubNubAsyncio.SDK_VERSION`.
3. Log or print the version for future reference.

```python
import asyncio
import os
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub_asyncio import PubNubAsyncio

async def display_sdk_info(pubnub: PubNubAsyncio):
    # Get and display the SDK version
    sdk_version = PubNubAsyncio.SDK_VERSION
    print(f"PubNub Asyncio SDK Version: {sdk_version}")

if __name__ == "__main__":
    # Configuration for PubNub instance
    pn_config = PNConfiguration()
    pn_config.subscribe_key = os.getenv('SUBSCRIBE_KEY', 'demo')  # Replace 'demo' with your subscribe key from PubNub Admin Portal
    pn_config.publish_key = os.getenv('PUBLISH_KEY', 'demo')      # Replace 'demo' with your publish key from PubNub Admin Portal
    pn_config.user_id = "sdk_version_demo_user"

    # Create and configure the event loop
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)
    
    # Initialize PubNub
    pubnub = PubNubAsyncio(pn_config)
    
    try:
        # Display SDK version information
        loop.run_until_complete(display_sdk_info(pubnub))
    finally:
        # Clean up resources
        loop.run_until_complete(pubnub.stop())
        loop.close()
```

Once you retrieve the SDK version, you can use this information for several tasks. For example:

* Reporting issues to support
* Diagnosing compatibility problems
* Verifying if a specific feature is available
* Checking if your application needs an upgrade

### Log the SDK version during initialization

You can also log the SDK version during initialization to keep a record of versions used across deployments.

```python
import os
import logging
import asyncio
from pubnub.pubnub import set_stream_logger  # Correct import for set_stream_logger
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub_asyncio import PubNubAsyncio

# Set up logging
logging.basicConfig(level=logging.INFO)
set_stream_logger('pubnub', logging.INFO)
logger = logging.getLogger('pubnub_app')

async def init_and_log_version(pubnub):
    logger.info(f"Initializing PubNub with SDK version: {PubNubAsyncio.SDK_VERSION}")
    
    # Demonstrate a basic operation to show logging in action
    try:
        time_response = await pubnub.time().future()
        logger.info(f"Current PubNub time: {time_response.result}")
    except Exception as e:
        logger.error(f"Error getting PubNub time: {e}")
        
    return pubnub

if __name__ == "__main__":
    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)
    
    # Configure PubNub
    pnconfig = PNConfiguration()
    pnconfig.subscribe_key = os.getenv('SUBSCRIBE_KEY', 'demo')  # Replace 'demo' with your subscribe key from PubNub Admin Portal
    pnconfig.publish_key = os.getenv('PUBLISH_KEY', 'demo')  # Replace 'demo' with your publish key from PubNub Admin Portal
    pnconfig.user_id = "logging_demo_user"
    pnconfig.ssl = True
    
    pubnub = PubNubAsyncio(pnconfig)
    
    try:
        loop.run_until_complete(init_and_log_version(pubnub))
        # Additional operations would go here
    finally:
        loop.run_until_complete(pubnub.stop())
        loop.close()
```