[Python] Why does python requests import take 15 seconds when venv is on Google Drive?

Discussão em 'Python' iniciado por Stack, Fevereiro 14, 2025.

  1. Stack

    Stack Membro Participativo

    Running PyCharm 2024.3.2 on Win11. Projects are located on Google Drive (including venv). When I add "import requests" to code, execution is delayed ~15 seconds.

    Created a new, identical project on C: drive with new venv. No delay.

    Pointed Google Drive project at C: Drive venv. No delay.

    What is it about requests that interacts with Google Drive this way?

    import logging
    logger = logging.getLogger(__name__)

    logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(levelname)s - %(message)s',
    datefmt='%Y-%m-%d %H:%M:%S'
    )

    logger.info('about to import requests')
    import requests
    logger.info('after requests')

    print("hello world")

    base_url = 'https://www.google.com'
    response = requests.get(base_url)
    print(response)
    logger.info('all done')


    Project GD, venv GD:

    "G:\My Drive\PyCharmProjectsHoth\requests_test\.venv\Scripts\python.exe" "G:\My Drive\PyCharmProjectsHoth\requests_test\test.py"
    2025-02-14 10:32:56 - INFO - about to import requests
    hello world
    2025-02-14 10:33:10 - INFO - after requests
    2025-02-14 10:33:10 - INFO - all done
    <Response [200]>


    Project C, venv C:

    C:\test\requests_test\.venv\Scripts\python.exe C:\test\requests_test\test.py
    2025-02-14 10:35:05 - INFO - about to import requests
    2025-02-14 10:35:05 - INFO - after requests
    hello world
    <Response [200]>
    2025-02-14 10:35:05 - INFO - all done


    Project GD, venv C:

    C:\test\requests_test\.venv\Scripts\python.exe "G:\My Drive\PyCharmProjectsHoth\requests_test\test.py"
    2025-02-14 10:36:16 - INFO - about to import requests
    2025-02-14 10:36:16 - INFO - after requests
    hello world
    <Response [200]>
    2025-02-14 10:36:16 - INFO - all done

    Continue reading...

Compartilhe esta Página