This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-10-20 22:24:51

nickbrickmaster
Scratcher
Registered: 2010-02-02
Posts: 500+

Python help

I need help with a program.
When I run this code, I get an error(below).

PLEASE HELP!

Code:

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")

Code:

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 EOFError

Ask me what I'm doing, wait an hour than roll a die, if it's 4-6, I'm playing Skyrim, if it's 1, I'm eating, if it's 2-3 I'm programming.
Steam: nickbrickmaster | RotMG: PwnThemAll | Minecraft: nickbrickmaster | League Of Legends: BaneOfTitans

Offline

 

#2 2011-10-20 22:26:10

laptop97
Scratcher
Registered: 2011-06-27
Posts: 1000+

Re: Python help

Advanced Topics?

Offline

 

#3 2011-10-20 22:27:53

nickbrickmaster
Scratcher
Registered: 2010-02-02
Posts: 500+

Re: Python help

laptop97 wrote:

Advanced Topics?

Nope. Misc. It's unrelated to scratch.


Ask me what I'm doing, wait an hour than roll a die, if it's 4-6, I'm playing Skyrim, if it's 1, I'm eating, if it's 2-3 I'm programming.
Steam: nickbrickmaster | RotMG: PwnThemAll | Minecraft: nickbrickmaster | League Of Legends: BaneOfTitans

Offline

 

#4 2011-10-20 22:37:04

nextstorm
Scratcher
Registered: 2009-12-13
Posts: 1000+

Re: Python help

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


bye

Offline

 

#5 2011-10-20 22:40:17

nickbrickmaster
Scratcher
Registered: 2010-02-02
Posts: 500+

Re: Python help

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


Ask me what I'm doing, wait an hour than roll a die, if it's 4-6, I'm playing Skyrim, if it's 1, I'm eating, if it's 2-3 I'm programming.
Steam: nickbrickmaster | RotMG: PwnThemAll | Minecraft: nickbrickmaster | League Of Legends: BaneOfTitans

Offline

 

#6 2011-10-20 22:51:14

nextstorm
Scratcher
Registered: 2009-12-13
Posts: 1000+

Re: Python help

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 defined

its 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)


bye

Offline

 

#7 2011-10-20 23:16:10

TVflea
Scratcher
Registered: 2010-08-14
Posts: 1000+

Re: Python help

laptop97 wrote:

Advanced Topics?

No, scratch is not programmed in python


-iNetMaster-'s not dead, get used to it. ! big_smile .
http://is.gd/YrQzXX

Offline

 

#8 2011-10-20 23:33:29

nickbrickmaster
Scratcher
Registered: 2010-02-02
Posts: 500+

Re: Python help

Why is this in advanced topics?


Ask me what I'm doing, wait an hour than roll a die, if it's 4-6, I'm playing Skyrim, if it's 1, I'm eating, if it's 2-3 I'm programming.
Steam: nickbrickmaster | RotMG: PwnThemAll | Minecraft: nickbrickmaster | League Of Legends: BaneOfTitans

Offline

 

#9 2011-10-21 00:09:48

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Python help

Because its an advanced topic.

HTML5 doesn't have to do with scratch directly, neither does php. It's still here.

Offline

 

#10 2011-10-21 04:09:42

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: Python help

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)


http://i.imgur.com/zeIZW.png

Offline

 

#11 2011-10-21 09:32:29

nickbrickmaster
Scratcher
Registered: 2010-02-02
Posts: 500+

Re: Python help

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


Ask me what I'm doing, wait an hour than roll a die, if it's 4-6, I'm playing Skyrim, if it's 1, I'm eating, if it's 2-3 I'm programming.
Steam: nickbrickmaster | RotMG: PwnThemAll | Minecraft: nickbrickmaster | League Of Legends: BaneOfTitans

Offline

 

#12 2011-10-21 11:19:59

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Python help

This belongs in Advanced Topics, it is an advanced topic. It is not All about Scratch.  smile

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

 

#13 2011-10-21 13:08:35

nickbrickmaster
Scratcher
Registered: 2010-02-02
Posts: 500+

Re: Python help

Magnie wrote:

This belongs in Advanced Topics, it is an advanced topic. It is not All about Scratch.  smile

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?  smile

Last edited by nickbrickmaster (2011-10-21 13:10:07)


Ask me what I'm doing, wait an hour than roll a die, if it's 4-6, I'm playing Skyrim, if it's 1, I'm eating, if it's 2-3 I'm programming.
Steam: nickbrickmaster | RotMG: PwnThemAll | Minecraft: nickbrickmaster | League Of Legends: BaneOfTitans

Offline

 

#14 2011-10-21 20:28:37

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Python help

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

 

#15 2011-10-21 20:36:41

maxskywalker
Scratcher
Registered: 2008-01-27
Posts: 1000+

Re: Python help

nickbrickmaster wrote:

Magnie wrote:

This belongs in Advanced Topics, it is an advanced topic. It is not All about Scratch.  smile

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?  smile
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

 

#16 2011-10-22 02:02:08

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: Python help

maxskywalker wrote:

nickbrickmaster wrote:

Magnie wrote:

This belongs in Advanced Topics, it is an advanced topic. It is not All about Scratch.  smile

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?  smile
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

 

#17 2011-10-22 17:29:59

nickbrickmaster
Scratcher
Registered: 2010-02-02
Posts: 500+

Re: Python help

maxskywalker wrote:

nickbrickmaster wrote:

Magnie wrote:

This belongs in Advanced Topics, it is an advanced topic. It is not All about Scratch.  smile

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?  smile
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.


Ask me what I'm doing, wait an hour than roll a die, if it's 4-6, I'm playing Skyrim, if it's 1, I'm eating, if it's 2-3 I'm programming.
Steam: nickbrickmaster | RotMG: PwnThemAll | Minecraft: nickbrickmaster | League Of Legends: BaneOfTitans

Offline

 

#18 2011-10-23 00:41:35

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Python help

Closed by request of owner.


http://www.blocks.scratchr.org/API.php?action=random&amp;return=image&amp;link1=http://i.imgur.com/OZn2RD3.png&amp;link2=http://i.imgur.com/duzaGTB.png&amp;link3=http://i.imgur.com/CrDGvvZ.png&amp;link4=http://i.imgur.com/POEpQyZ.png&amp;link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

Board footer