无法在python DBInvalidArgError(python 2.4)中打开shelf

2024-05-29 09:45:31 发布

您现在位置:Python中文网/ 问答频道 /正文

selectedfile = ""
    while selectedfile == "":
        print "\t\t ~Episodes With Scores~"
    for filename in datfiles:
        #prints filename without .dat
        print "\n\t\t" + filename[0:-4]
    selectedfile = raw_input("\n\nType the name of the episode you want     to see scores for.")
    selectedfile = selectedfile + ".dat"
    highscores = shelve.open(selectedfile, "r")

在这段代码之后,特别是当我试图打开所选文件时,会出现以下错误:

Traceback (most recent call last):
File "D:\Trivia Challenge\trivia_2.py", line 463, in -toplevel-
File "D:\Trivia Challenge\trivia_2.py", line 454, in main
File "D:\Trivia Challenge\trivia_2.py", line 293, in get_high_scores
File "shelve.pyc", line 231, in open
File "shelve.pyc", line 212, in init
File "anydbm.pyc", line 83, in open
File "dbhash.pyc", line 16, in open
File "bsddb__init__.pyc", line 299, in hashopen
DBInvalidArgError: (22, 'Invalid argument -- .\tutorial.dat: unsupported >hash version: 9')

它与python.exe,但使用pythonshell时会出现错误。在


Tags: inpyforlineopenfilenameshelvedat

热门问题