Python Forum
Attribute of module shelve doesn't work
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Attribute of module shelve doesn't work
#1
1
2
3
4
5
import shelve
db = shelve.open('experement')
db['name'] = 'Sam'
db['age'] = 45
db.close()
Error:
Traceback (most recent call last): File "C:/Users/Владелец/Desktop/experements/shelve.py", line 1, in <module> import shelve File "C:/Users/Владелец/Desktop/experements\shelve.py", line 2, in <module> db = shelve.open('experement') AttributeError: 'module' object has no attribute 'open'
Reply
#2
Your file is named shelve.py, so python looks for open in it. Rename your file to something different
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PIP doesn't work YKR 1 673 Mar-28-2025, 02:10 PM
Last Post: snippsat
  I'm trying to install python 3.11.11 on windows 10 - it doesn't work Petonique 2 1,798 Feb-04-2025, 05:42 PM
Last Post: snippsat
  module 'openpyxl.workbook' has no attribute 'active' lsaavedra21 5 1,669 Oct-30-2024, 06:26 PM
Last Post: lsaavedra21
  Extending list doesn't work as expected mmhmjanssen 2 1,380 May-09-2024, 05:39 PM
Last Post: Pedroski55
  getpass.getpass() results in AttributeError: module 'os' has no attribute 'O_NOCTTY' EarthAndMoon 4 2,791 Oct-03-2023, 02:00 PM
Last Post: deanhystad
  Why doesn't calling a parent constructor work with arbitrary keyword arguments? PurposefulCoder 4 1,908 Jun-24-2023, 02:14 PM
Last Post: deanhystad
  Why doesn't this code work? What is wrong with path? Melcu54 7 3,500 Jan-29-2023, 06:24 PM
Last Post: Melcu54
  color code doesn't work harryvl 1 1,834 Dec-29-2022, 08:59 PM
Last Post: deanhystad
  How do I get pygame module to work in Spyder? (Mac) FirstBornAlbratross 18 9,073 Dec-18-2022, 06:43 PM
Last Post: FirstBornAlbratross
  client.get_all_tickers() Doesn't work gerald 2 2,582 Jun-16-2022, 07:59 AM
Last Post: gerald

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020