Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible .get bug in version 2.32.3 #6753

Closed
mhenrichsen opened this issue Jun 27, 2024 · 2 comments
Closed

Possible .get bug in version 2.32.3 #6753

mhenrichsen opened this issue Jun 27, 2024 · 2 comments

Comments

@mhenrichsen
Copy link

When executing a file named ast.py which .get(url) it fails with AttributeError: partially initialized module 'requests' has no attribute 'get' (most likely due to a circular import)

Expected Result

To fetch the contents.

  1. Create a file named ast.py

x = requests.get('https://w3schools.com')
print(x.status_code)
  1. rename the file for success.

System Information

$ python -m requests.help
{
  "chardet": {
    "version": null
  },
  "charset_normalizer": {
    "version": "3.3.2"
  },
  "cryptography": {
    "version": ""
  },
  "idna": {
    "version": "3.7"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.12.4"
  },
  "platform": {
    "release": "23.2.0",
    "system": "Darwin"
  },
  "pyOpenSSL": {
    "openssl_version": "",
    "version": null
  },
  "requests": {
    "version": "2.32.3"
  },
  "system_ssl": {
    "version": "30300010"
  },
  "urllib3": {
    "version": "2.2.1"
  },
  "using_charset_normalizer": true,
  "using_pyopenssl": false
}
@nateprewitt
Copy link
Member

ast is a module in the standard library. Shadowing commonly used modules will lead to breakages in most Python libraries. This isn't something we can address in Requests, this is a fundamental of the language.

@nateprewitt nateprewitt closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2024
@mhenrichsen
Copy link
Author

@nateprewitt thanks for letting me know. It was driving me crazy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants