Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R133 runtime error #28

Closed
GoogleCodeExporter opened this issue Dec 15, 2015 · 3 comments
Closed

R133 runtime error #28

GoogleCodeExporter opened this issue Dec 15, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. copy files (utils.py and search.py) into Python 3.2 standard window editor, 
etc.
2. fix the print() syntax issues
3. run search.py
4. get this traceback:
Traceback (most recent call last):
  File "C:\Python32\myscripts\search.py", line 469, in <module>
    U=Dict(V=142)))
  File "C:\Python32\myscripts\search.py", line 428, in UndirectedGraph
    return Graph(dict=dict, directed=False)
  File "C:\Python32\myscripts\search.py", line 396, in __init__
    if not directed: self.make_undirected()
  File "C:\Python32\myscripts\search.py", line 400, in make_undirected
    for a in self.dict.keys():
RuntimeError: dictionary changed size during iteration
>>> Traceback (most recent call last):
  File "C:\Python32\myscripts\search.py", line 469, in <module>
    U=Dict(V=142)))
  File "C:\Python32\myscripts\search.py", line 428, in UndirectedGraph
    return Graph(dict=dict, directed=False)
  File "C:\Python32\myscripts\search.py", line 396, in __init__
    if not directed: self.make_undirected()
  File "C:\Python32\myscripts\search.py", line 400, in make_undirected
    for a in self.dict.keys():
RuntimeError: dictionary changed size during iteration
>>> 


What is the expected output? What do you see instead?

I am a student in new on-line aima class.

I am new to python .. naturally downloaded 3.2 and worked through tutorial. I 
rather expected these programs to run properly, not to have to spend much time 
fixing them. By studying the actual data structures, I can really understand 
how to implement the pseudo-codes (if the program worked!) .. looked at sources 
for this run-time error on Internet and this seems to be rather tricky error 
... Can you provide a fix? Thank you.


What version of the product are you using? On what operating system?

I am trying to run the aima class example codes using Python 3.2 (evidently a 
mistake) on Windows XP PC. In particular I am trying to run the search.py astar 
program.

Please provide any additional information below.


Original issue reported on code.google.com by asi...@acsw.com on 18 Oct 2011 at 9:26

@GoogleCodeExporter
Copy link
Author

Python 3 isn't yet supported or recommended -- for that you want Python 2.5 
through 2.7, and the ReadMe needs to be clearer. This particular problem comes 
from an incompatible change in Python 3: dict.keys() returns an iterator there, 
where in Python 2 it returns a list which isn't affected by assignments to the 
underlying dict. There's no bug here, but something that'll need attention in 
the eventual move to Python 3.

I'm sorry the docs weren't explicit about this.

Original comment by wit...@gmail.com on 19 Oct 2011 at 5:04

@GoogleCodeExporter
Copy link
Author

This issue was closed by revision r137.

Original comment by wit...@gmail.com on 19 Oct 2011 at 5:21

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Thank you very much. I will install Python 2.7. I am enjoying the class. I took 
this same course (same title, anyway) in graduate school in ~1978, I think, at 
UKy. Ha, we were studying SHRDLU and the block world; I was figuring out Lisp 
on punched cards. I probably still have Terry Winograd's book on a shelf 
somewhere! AIMA looks a little different nowadays. :-}
--Warren Lacefield
warren.lacefield@wmich.edu

Original comment by asi...@acsw.com on 19 Oct 2011 at 6:59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant