Skip to content

πŸ› [Bug]: Typing-Speed-Tester crashes with ModuleNotFoundError β€” uses aiohttp external dependencyΒ #1314

Description

@vipul674

Summary

The Typing-Speed-Tester utility (utilities/Typing-Speed-Tester/Typing-Speed-Tester.py) crashes on import because it uses aiohttp, an external dependency that is not part of Pythons standard library. The project README explicitly states "No External Dependencies β€” Only use standard library."

Evidence

In utilities/Typing-Speed-Tester/Typing-Speed-Tester.py:6:

import aiohttp

Running the script without aiohttp installed produces:

ModuleNotFoundError: No module named aiohttp

The aiohttp library is used on lines 34 and 50 for async HTTP requests to fetch random quotes. This can be replaced with urllib.request from the standard library.

Affected Files

  • utilities/Typing-Speed-Tester/Typing-Speed-Tester.py (lines 6, 34, 50)

Reproduction Steps

  1. Ensure aiohttp is NOT installed: pip uninstall aiohttp
  2. Run python utilities/Typing-Speed-Tester/Typing-Speed-Tester.py
  3. The script crashes immediately with ModuleNotFoundError: No module named aiohttp

Expected Behavior

The script should run using only Python standard library modules, as stated in the project README.

Actual Behavior

The script crashes on startup due to missing external dependency.

Impact

The Typing-Speed-Tester is unusable for any user who hasnt explicitly installed aiohttp. This contradicts the projects "No External Dependencies" promise and creates a barrier to entry for new users and contributors.

Suggested Fix

Replace aiohttp usage with urllib.request from the standard library:

import urllib.request
import json

def fetch_phrase():
    urls = [
        "https://dummyjson.com/quotes/random",
        "https://api.quotable.io/random"
    ]
    for url in urls:
        try:
            req = urllib.request.Request(url, headers={User-Agent: Mozilla/5.0})
            with urllib.request.urlopen(req, timeout=3) as resp:
                data = json.loads(resp.read().decode())
                phrase = data.get(quote) or data.get(content)
                if phrase:
                    return phrase
        except Exception:
            continue
    return None

This removes the aiohttp and asyncio imports and replaces the async fetch with synchronous urllib.request.

Candidate Validation

GSSoC 2026

This is a valid bug fix suitable for GSSoC 2026 contributors. The fix involves replacing an external dependency with standard library equivalents, which is a good exercise in understanding Python imports and network requests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions