I need help with a program.
When I run this code, I get an error(below).
PLEASE HELP!
import easygui
import pickle
yn=easygui.ynbox("Add a quest?")
if yn == 1:
inputfile = easygui.enterbox("File?")
file = open("questlist.dat", "r")
questlist = pickle.load(file)
oldquestlist = questlist
file = open("questlist.dat", "w")
questlist = pickle.load(file)
questlist = oldquestlist
questlist.append(inputfile)
pickle.dumps(questlist, "questlist.dat")Traceback (most recent call last):
File "Z:\python_programs\Textgame\AddAQuest.py", line 7, in <module>
questlist = pickle.load(file)
File "C:\Python26\lib\pickle.py", line 1370, in load
return Unpickler(file).load()
File "C:\Python26\lib\pickle.py", line 858, in load
dispatch[key](self)
File "C:\Python26\lib\pickle.py", line 880, in load_eof
raise EOFErrorOffline
laptop97 wrote:
Advanced Topics?
Nope. Misc. It's unrelated to scratch.
Offline
nextstorm wrote:
That's a weird version of python you have
mine has errors like this
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
asdf
NameError: name 'asdf' is not defined
its 2.6
and ur doing it wrong
asdf = "funny"
asdf
funny
Offline
nickbrickmaster wrote:
nextstorm wrote:
That's a weird version of python you have
mine has errors like this
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
asdf
NameError: name 'asdf' is not definedits 2.6
and ur doing it wrong
asdf = "funny"
asdf
funny
I know
I was just showing you an error
EDIT: Oh yeah, python's at 3.1.3 now :P
Last edited by nextstorm (2011-10-20 22:51:33)
Offline
Why is this in advanced topics?
Offline
Well EOF means end of file, so I think the program has found something, but unexpectedly, the file ended.
Are you sure pickle.py is in the right place?
Last edited by rookwood101 (2011-10-21 04:10:53)
Offline
rookwood101 wrote:
Well EOF means end of file, so I think the program has found something, but unexpectedly, the file ended.
Are you sure pickle.py is in the right place?
I've done this before. It's always worked.
kayybee wrote:
Because its an advanced topic.
HTML5 doesn't have to do with scratch directly, neither does php. It's still here.
I've seen py topics in misc
Offline
This belongs in Advanced Topics, it is an advanced topic. It is not All about Scratch.
That error just means it can't save it to or load data from whatever file with that name. I'm assuming the file you want has not been created.
Nextstorm: You are using the Python IDLE program, that's why you have that error. Usually you run Python programs from the terminal/command line or you double click the file on Windows or Mac computers.
Offline
Magnie wrote:
This belongs in Advanced Topics, it is an advanced topic. It is not All about Scratch.
![]()
That error just means it can't save it to or load data from whatever file with that name. I'm assuming the file you want has not been created.
Nextstorm: You are using the Python IDLE program, that's why you have that error. Usually you run Python programs from the terminal/command line or you double click the file on Windows or Mac computers.
IT WAS IN MISC.
The file is there, I have checked.
IDLE is the same as python command line.
You obviously know 1% of what you're talking about and im not trying to be rude. You maybe should not have posted here?
Last edited by nickbrickmaster (2011-10-21 13:10:07)
Offline
Well, when pickling stuff, it's open("file_name.dat", "rb") or "wb" or "ab", and so on. Note the "b". I think it stands for 'binary'.
Offline
nickbrickmaster wrote:
Magnie wrote:
This belongs in Advanced Topics, it is an advanced topic. It is not All about Scratch.
![]()
That error just means it can't save it to or load data from whatever file with that name. I'm assuming the file you want has not been created.
Nextstorm: You are using the Python IDLE program, that's why you have that error. Usually you run Python programs from the terminal/command line or you double click the file on Windows or Mac computers.IT WAS IN MISC.
Are you sure you didn't make a mistake, because the topic in Misc says 'moved:'. That means it wasn't.
The file is there, I have checked.
IDLE is the same as python command line.
Not quite. IDLE is the interactive prompt. There's a difference.
You obviously know 1% of what you're talking about and im not trying to be rude. You maybe should not have posted here?![]()
Also not trying to be rude, but it is actually you who doesn't know. By 'command line', I think he means running it from the actual command line (Terminal on a Mac, Command Prompt on a Windows (much less useful than Terminal- it doesn't do Bash, I think)). IDLE is the program, the command line is typing 'python [program_name]' (never done that, not quite sure if it's true) or 'python'. This is a bit off topic, but it's actually very useful for those who don't want to have to make the rather processor-heavy JDK download.
Offline
maxskywalker wrote:
nickbrickmaster wrote:
Magnie wrote:
This belongs in Advanced Topics, it is an advanced topic. It is not All about Scratch.
![]()
That error just means it can't save it to or load data from whatever file with that name. I'm assuming the file you want has not been created.
Nextstorm: You are using the Python IDLE program, that's why you have that error. Usually you run Python programs from the terminal/command line or you double click the file on Windows or Mac computers.IT WAS IN MISC.
Are you sure you didn't make a mistake, because the topic in Misc says 'moved:'. That means it wasn't.
The file is there, I have checked.
IDLE is the same as python command line.
Not quite. IDLE is the interactive prompt. There's a difference.
You obviously know 1% of what you're talking about and im not trying to be rude. You maybe should not have posted here?![]()
Also not trying to be rude, but it is actually you who doesn't know. By 'command line', I think he means running it from the actual command line (Terminal on a Mac, Command Prompt on a Windows (much less useful than Terminal- it doesn't do Bash, I think)). IDLE is the program, the command line is typing 'python [program_name]' (never done that, not quite sure if it's true) or 'python'. This is a bit off topic, but it's actually very useful for those who don't want to have to make the rather processor-heavy JDK download.
I admit, I didn't know that it was in Misc.
maxskywalker cleared everything else up pretty well. Terminal is the term for the console for Linux as well.
Offline
maxskywalker wrote:
nickbrickmaster wrote:
Magnie wrote:
This belongs in Advanced Topics, it is an advanced topic. It is not All about Scratch.
![]()
That error just means it can't save it to or load data from whatever file with that name. I'm assuming the file you want has not been created.
Nextstorm: You are using the Python IDLE program, that's why you have that error. Usually you run Python programs from the terminal/command line or you double click the file on Windows or Mac computers.IT WAS IN MISC.
Are you sure you didn't make a mistake, because the topic in Misc says 'moved:'. That means it wasn't.
It was in misc, and your py topics were in misc.
The file is there, I have checked.
IDLE is the same as python command line.
Not quite. IDLE is the interactive prompt. There's a difference.
by commsand line i mean opening it without idle. i am still new bt know about some things.
You obviously know 1% of what you're talking about and im not trying to be rude. You maybe should not have posted here?![]()
Also not trying to be rude, but it is actually you who doesn't know. By 'command line', I think he means running it from the actual command line (Terminal on a Mac, Command Prompt on a Windows (much less useful than Terminal- it doesn't do Bash, I think)). IDLE is the program, the command line is typing 'python [program_name]' (never done that, not quite sure if it's true) or 'python'. This is a bit off topic, but it's actually very useful for those who don't want to have to make the rather processor-heavy JDK download.
Offline