AttributeError: partially initialized module 'logging' has no attribute 'getLogger'

When running a script today that has run fine until now, I get this error related to calling requests. Anyone know how to get this running again? Here’s the import order in my script:

import os
import requests
import datetime
import json
import time
import re
from bs4 import BeautifulSoup
from spacy_llm.util import assemble
from unidecode import unidecode
from num2words import num2words

And here’s the error:

Traceback (most recent call last):
File "/home/runner/Newsbang/", line 2, in <module>
import requests
File "/home/runner/Newsbang/venv/lib/python3.10/site-packages/requests/", line 43, in <module>
import urllib3
File "/home/runner/Newsbang/venv/lib/python3.10/site-packages/urllib3/", line 7, in <module>
import logging
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/logging/", line 26, in <module>
import sys, os, time, io, re, traceback, warnings, weakref,
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/", line 5, in <module>
import linecache
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/", line 11, in <module>
import tokenize
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/", line 35, in <module>
from token import *
File "/home/runner/Newsbang/", line 1, in <module>
import tiktoken
File "/home/runner/Newsbang/venv/lib/python3.10/site-packages/tiktoken/", line 2, in <module>
from .core import Encoding as Encoding
File "/home/runner/Newsbang/venv/lib/python3.10/site-packages/tiktoken/", line 4, in <module>
from concurrent.futures import ThreadPoolExecutor
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/concurrent/futures/", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/concurrent/futures/", line 43, in <module>
LOGGER = logging.getLogger("concurrent.futures")
AttributeError: partially initialized module 'logging' has no attribute 'getLogger' (most likely due to a circular import)

UPDATE: No scripts using requests now run. Starting a new Repl and attempting to install requests through Package manager results in:

--> poetry add 'requests 2.31.0'
Using version ^2.31.0 for requests

Could not find a matching version of package 2.31.0
exit status 1

Is this a problem with Replit?

I may have found the solution. I had another unrelated script, which I named in the same folder. For whatever reason running the main script attempted to call this script. Deleting got the main script running again.

yep, to prevent this in future you could type import <file> before creating <file>.py so you can see whether the file would override an existing module.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.