Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 写入二进制文件时参数无效_Python_Python 3.x_Pickle - Fatal编程技术网

Python 写入二进制文件时参数无效

Python 写入二进制文件时参数无效,python,python-3.x,pickle,Python,Python 3.x,Pickle,我试图使用pickle读取二进制文件,调整其内容,然后用新更新的字典覆盖二进制文件的内容。 但是,我收到了以下错误: startHandCountFile=open(“startHandCount”,“wb”)操作错误:[Errno 22] 无效参数:“startHandCount” 我目前的理解是,它应该可以工作,因为该文件与正在运行的python文件位于同一目录中,并且我已经检查了该文件是否拼写错误 我的代码: startHandCountFile = open("startHand

我试图使用pickle读取二进制文件,调整其内容,然后用新更新的字典覆盖二进制文件的内容。 但是,我收到了以下错误:

startHandCountFile=open(“startHandCount”,“wb”)操作错误:[Errno 22] 无效参数:“startHandCount”

我目前的理解是,它应该可以工作,因为该文件与正在运行的python文件位于同一目录中,并且我已经检查了该文件是否拼写错误

我的代码:

    startHandCountFile = open("startHandCount", "rb")
    self.startHandCount = pickle.load(startHandCountFile)
    self.currentStartHandCount = self.startHandCount
    self.startHandCount[startingTotal][1] += 1
    print("print still working")
    startHandCountFile.close()

    startHandCountFile = open("startHandCount", 'wb')
    pickle.dump(self.currentStartHandCount, startHandCountFile)
    startHandCountFile.close()

感谢您的帮助。

尝试在我的dropbox外部和硬盘上的目录中运行我的程序,解决了我遇到的错误。

尝试在我的dropbox外部和硬盘上的目录中运行我的程序,解决了我遇到的错误。

您是否有机会使用,一些奇怪的文件系统,比如MVFS(clearcase)?@Jean-François Fabre对MVFS不太熟悉,但是目录保存在我的dropbox中。dropbox会被视为MVFS吗?这其中存在同步问题。@Jean-François Fabre感谢您的帮助。仅仅将文件本地存储在我的硬盘上似乎就解决了这个问题。你是否在使用像MVFS(clearcase)这样奇怪的文件系统?@Jean François Fabre对MVFS不太熟悉,但目录保存在我的dropbox中。dropbox会被视为MVFS吗?这其中存在同步问题。@Jean-François Fabre感谢您的帮助。只是将文件本地存储在硬盘上似乎解决了这个问题。