I'm running Google App Engine on the dev server.
Here is my models file:
from google.appengine.ext import db
import pickle
import re
re_dept_code = re.compile(r'[A-Z]{2,}')
re_course_number = re.compile(r'[0-9]{4}')
class DependencyArcHead(db.Model):
sink = db.ReferenceProperty()
tails = db.ListProperty()
class DependencyArcTail(db.Model):
courses = db.ListProperty()
It gives this error:
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3192, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 3135, in _Dispatch
base_env_dict=env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 516, in Dispatch
base_env_dict=base_env_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2394, in Dispatch
self._module_dict)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2304, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 2200, in ExecuteOrImportScript
exec module_code in script_module.__dict__
File "main.py", line 19, in <module>
from src.Models import Course, findCourse, validateCourse, dictForJSON, clearAndBu开发者_JS百科ildDependencyGraph
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1279, in Decorate
return func(self, *args, **kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1929, in load_module
return self.FindAndLoadModule(submodule, fullname, search_path)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1279, in Decorate
return func(self, *args, **kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1831, in FindAndLoadModule
description)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1279, in Decorate
return func(self, *args, **kwargs)
File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver.py", line 1782, in LoadModuleRestricted
description)
File "src\Models.py", line 14, in <module>
class DependencyArcHead(db.Model):
File "src\Models.py", line 17, in DependencyArcHead
tails = db.ListProperty()
TypeError: __init__() takes at least 2 arguments (1 given)
What am I doing wrong?
Possible solution: I was missing the type_name
argument in the listProperty()
constructor. Oops.
精彩评论