Pyomo: Error during generation of .nl-file for solver interface - pyomo

I am using a concrete model to set up several optimization problems.
However, in some cases, there occurs an error when solving the pyomo model with Gurobi_AMPL via the SolverFactory (opt = SolverFactory('gurobi_ampl',solver_io='nl')).
In this case, python returns the following error code in combination with a MemoryError:
File "C:\win32app\Winpython\python-2.7.9\lib\site-packages\pyomo\opt\base\solvers.py, line 599, in solve
self._presolve(*args,**kwds)
File "C:\win32app\Winpython\python-2.7.9\lib\site-packages\pyomo\solvers\plugins\solvers\ASL.py", line 189, in _presolve
SystemCallSolver._presolve(self, *args, **kwds)
File "C:\win32app\Winpython\python-2.7.9\lib\site-packages\pyomo\opt\solver\shellcmd.py", line 196, in _pyresolve
OptSolver._presolve(self, *args, **kwds)
File "C:\win32app\Winpython\python-2.7.9\lib\site-packages\pyomo\opt\base\solvers.py", line 699, in _presolve
**kwds)
File "C:\win32app\Winpython\python-2.7.9\lib\site-packages\pyomo\opt\base\solvers.py", line 770, in _convert_problem
**kwds)
File "C:\win32app\Winpython\python-2.7.9\lib\site-packages\pyomo\opt\base\convert.py", line 110, in convert_problem
problem_files, symbol_map = converter.apply(*tmp, **tmpkw)
File "C:\win32app\Winpython\python-2.7.9\lib\site-packages\pyomo\solvers\plugins\converter\model.py", line 192, in apply
io_options=io_options)
File "C:\win32app\Winpython\python-2.7.9\lib\site-packages\pyomo\core\base\block.py", line 1681, in write
io_options)
File "C:\win32app\Winpython\python-2.7.9\lib\site-packages\pyomo\repn\plugins\ampl\ampl_.py", line 392, in __call__
include_all_variable_bounds=include_all_variable_bounds)
File "C:\win32app\Winpython\python-2.7.9\lib\site-packages\pyomo\repn\plugins\ampl\ampl_.py", line 1177, in _print_model_NL
for column_id,var_ID in enumerate(full_var_list)])
File "C:\win32app\Winpython\python-2.7.9\lib\site-packages\pyomo\core\kernel\symbol_map.py", line 68, in addSymbols
self.bySymbol.update((symb_, weakref_ref(obj_)) for obj_,symb_ in tuples)
MemoryError
The error is probably not really a MemoryError since I do not get any excessive peak in the memory usage.
But, it seems to me that the generation of the .nl-file causes the error.
Nevertheless, the separate generation of the .nl-file using model.write('model.nl'), generates the .nl-file without error.
Is this a familiar problem?
Can such an error be caused by setting up the model with improper parameter values?

Related

Odoo 10 - Cannot unblock a work center in dashboard, neither on individual work orders

my work center is blocked :
But when I try to unblock, I always get this error : (the same error happens if I try to unblock the work order).
Please let me know if more details needed, I am new in stack overflow.
Thanks in advance
Odoo Server Error
Traceback (most recent call last):
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\http.py", line 642, in \_handle_exception
return super(JsonRequest, self).\_handle_exception(exception)
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\http.py", line 684, in dispatch
result = self.\_call_function(\*\*self.params)
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\http.py", line 334, in \_call_function
return checked_call(self.db, \*args, \*\*kwargs)
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\service\\model.py", line 101, in wrapper
return f(dbname, \*args, \*\*kwargs)
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\http.py", line 327, in checked_call
result = self.endpoint(\*a, \*\*kw)
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\http.py", line 942, in __call__
return self.method(\*args, \*\*kw)
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\http.py", line 507, in response_wrap
response = f(\*args, \*\*kw)
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\addons\\web\\controllers\\main.py", line 899, in call_button
action = self.\_call_kw(model, method, args, {})
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\addons\\web\\controllers\\main.py", line 887, in \_call_kw
return call_kw(request.env\[model\], method, args, kwargs)
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\api.py", line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\api.py", line 680, in call_kw_multi
result = method(recs, \*args, \*\*kwargs)
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\addons\\mrp\\models\\mrp_workcenter.py", line 160, in unblock
times.write({'date_end': fields.Datetime.now()})
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\models.py", line 3592, in write
self.\_write(old_vals)
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\models.py", line 3823, in \_write
self.recompute()
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\models.py", line 5378, in recompute
recs.browse(ids).\_write(dict(vals))
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\models.py", line 3693, in \_write
cr.execute(query, params + (sub_ids,))
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\sql_db.py", line 154, in wrapper
return f(self, \*args, \*\*kwargs)
File "D:\\Dropbox\\myProjects\\Python\\Odoo10\\odoo\\sql_db.py", line 231, in execute
res = self.\_obj.execute(query, params)
NumericValueOutOfRange: integer out of range
I was expecting the work center would became unblocked, and all the work orders related to it.
I am not able to find the problem, the export of tables all seem OK
When unblocking a workcenter Odoo will set "now" as date_end to every productivity record (model mrp.workcenter.productivity) without an end date belonging to the workcenter. That's the part in your traceback with "unblock" at the end.
That itself triggers a recomputation of the duration field on the productivity records. If i'm not wrong the duration is computed in minutes as difference of date_end and date_start. It seems there are records producing very high numbers.
That could be because you either have very bad data on those records or you have implemented another computation method which is computing wrong.

How do I fix this KeyError error using Flask-SocketIO?

This seems to be a common problem when I search around, but I can't seem to find a viable resolution. The error is not very helpful as far as I can tell as it doesn't really tell you why the saved session is gone.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py", line 481, in handle_one_response
result = self.application(self.environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask_socketio/__init__.py", line 37, in __call__
start_response)
File "/usr/local/lib/python2.7/dist-packages/engineio/middleware.py", line 47, in __call__
return self.engineio_app.handle_request(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/socketio/server.py", line 303, in handle_request
return self.eio.handle_request(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/engineio/server.py", line 226, in handle_request
environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/engineio/socket.py", line 79, in handle_get_request
start_response)
File "/usr/local/lib/python2.7/dist-packages/engineio/socket.py", line 118, in _upgrade_websocket
return ws(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/engineio/async_eventlet.py", line 13, in __call__
return super(WebSocketWSGI, self).__call__(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/eventlet/websocket.py", line 127, in __call__
self.handler(ws)
File "/usr/local/lib/python2.7/dist-packages/engineio/socket.py", line 180, in _websocket_handler
self.receive(pkt)
File "/usr/local/lib/python2.7/dist-packages/engineio/socket.py", line 48, in receive
self.server._trigger_event('message', self.sid, pkt.data)
File "/usr/local/lib/python2.7/dist-packages/engineio/server.py", line 330, in _trigger_event
return self.handlers[event](*args)
File "/usr/local/lib/python2.7/dist-packages/socketio/server.py", line 429, in _handle_eio_message
self._handle_event(sid, pkt.namespace, pkt.id, pkt.data)
File "/usr/local/lib/python2.7/dist-packages/socketio/server.py", line 371, in _handle_event
r = self._trigger_event(data[0], namespace, sid, *data[1:])
File "/usr/local/lib/python2.7/dist-packages/socketio/server.py", line 397, in _trigger_event
return self.handlers[namespace][event](*args)
File "/usr/local/lib/python2.7/dist-packages/flask_socketio/__init__.py", line 199, in _handler
self.server.environ[sid]['saved_session'] = {}
KeyError: 'baee47721e474a1a9885b41ee0ce1847'
First of all, upgrade the following packages: flask-socketio, python-socketio and python-engineio.
I think that will address your issues. This problem occurred with older versions of Flask-SocketIO. The cause that I identified for this condition was that a handler function (these functions you decorate with socketio.on() decorator) ran for a very long time without properly releasing the CPU. If the function ran for longer than 60 seconds without releasing the CPU, then the system mistakenly considered that the client was gone and disconnected the session, causing a KeyError when that session was accessed later.
The error is addressed in the latest release. But also please make sure you release the CPU so that other tasks that run in the background get a chance to do what they need to do.

How to install neo4django in virtual environment

I receive the error below when trying to install neo4django in my virtual environment. Not sure what the problem is. The server is running on my machine and py2neo works with the restful api, but not neo4django.
I'm running ubuntu 12.0.4 with the latest version of neo4j installed (1.9-M01) and jdk 1.7 (openjkd) installed with JAVA_HOME pointing to: /usr/lib/jvm/java-7-openjdk-amd64
Traceback (most recent call last): File "manage.py", line 10, in
execute_from_command_line(sys.argv) File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/django/core/management/init.py",
line 443, in execute_from_command_line
utility.execute() File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/django/core/management/init.py",
line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/django/core/management/base.py",
line 196, in run_from_argv
self.execute(*args, **options.dict) File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/django/core/management/base.py",
line 232, in execute
output = self.handle(*args, **options) File "/home/alan/workspace/neowiki/neowiki/nodes/management/commands/testcmd.py",
line 10, in handle
pete = Person.objects.create(name='Pete') File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/neo4django/db/models/manager.py",
line 41, in create
return self.get_query_set().create(*kwargs) File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/neo4django/db/models/query.py",
line 747, in create
return super(NodeQuerySet, self).create(*kwargs) File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/django/db/models/query.py",
line 377, in create
obj.save(force_insert=True, using=self.db) File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/neo4django/db/models/base.py",
line 325, in save
return super(NodeModel, self).save(using=using, **kwargs) File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/django/db/models/base.py",
line 463, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update) File
"/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/neo4django/db/models/base.py",
line 340, in save_base
self._save_neo4j_node(using) File "", line 2, in _save_neo4j_node File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/neo4django/db/models/base.py",
line 115, in trans_method
ret = func(*args, **kw) File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/neo4django/db/models/base.py",
line 370, in _save_neo4j_node
typesToIndex=type_names_to_index) File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/neo4django/neo4jclient.py",
line 179, in gremlin_tx
return self.gremlin(script, tx=True, **params) File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/neo4django/neo4jclient.py",
line 168, in gremlin
params) File "/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/neo4django/neo4jclient.py",
line 153, in send_script
script_rv = ext.execute_script(s, params=params, **execute_kwargs) File
"/home/alan/workspace/neowiki/venv/local/lib/python2.7/site-packages/neo4jrestclient/client.py",
line 1960, in call
raise StatusException(response.status, msg) neo4jrestclient.request.StatusException: Error [400]: Bad Request. Bad
request syntax or unsupported method. Invalid data sent:
org.codehaus.groovy.control.MultipleCompilationErrorsException:
startup failed: Script4.groovy: 94: unable to resolve class
org.neo4j.cypher.javacompat.CypherParser # line 94, column 1.
import org.neo4j.cypher.javacompat.CypherParser ^
1 error
My requirements.txt includes:
-e git://github.com/scholrly/neo4django.git#eefdf6a122fdbe26c62b6563f9ff6b30a4de2f93#egg=neo4django-dev
neo4jrestclient==1.7.0
Any help is greatly appreciated!
From what I can see, your installation is fine. The problem is the version of Neo4j.
So far, we only support Neo4j 1.6-1.8. While I try to support all major releases in use, I typically extend support for milestones closer to a general release. For example, I didn't extend support to Neo4j 1.8 until it hit milestone 6.
Is there a particular reason you're using 1.9M01, or would the most recent stable release (1.8GA) suffice?

Django celery worker __init__() error

The tech stack looks like this:
Django frontend and backend
Celery worker queue for asynchronously processing time consuming tasks
Within the past day or two I've noticed a lot of these kinds of stack traces both locally and in production:
[2012-07-05 20:31:01,583: CRITICAL/MainProcess] Task site_endpoint.tasks.async_inbound_message[a950736c-ff93-420c-9fbf-6deb2b88ff4d] INTERNAL ERROR: TypeError('__init__() takes at least 3 arguments (1 given)',)
Traceback (most recent call last):
File "/projects/site/venv/lib/python2.7/site-packages/celery/execute/trace.py", line 192, in trace_task
R = I.handle_error_state(task, eager=eager)
File "/projects/site/venv/lib/python2.7/site-packages/celery/execute/trace.py", line 91, in handle_error_state
}[self.state](task, store_errors=store_errors)
File "/projects/site/venv/lib/python2.7/site-packages/celery/execute/trace.py", line 114, in handle_failure
task.backend.mark_as_failure(req.id, exc, self.strtb)
File "/projects/site/venv/lib/python2.7/site-packages/celery/backends/base.py", line 96, in mark_as_failure
traceback=traceback)
File "/projects/site/venv/lib/python2.7/site-packages/celery/backends/base.py", line 229, in store_result
return self._store_result(task_id, result, status, traceback, **kwargs)
File "/projects/site/venv/lib/python2.7/site-packages/djcelery/backends/database.py", line 26, in _store_result
traceback=traceback)
File "/projects/site/venv/lib/python2.7/site-packages/djcelery/managers.py", line 40, in _inner
return fun(*args, **kwargs)
File "/projects/site/venv/lib/python2.7/site-packages/djcelery/managers.py", line 164, in store_result
"traceback": traceback})
File "/projects/site/venv/lib/python2.7/site-packages/djcelery/managers.py", line 82, in update_or_create
return self.get_query_set().update_or_create(**kwargs)
File "/projects/site/venv/lib/python2.7/site-packages/djcelery/managers.py", line 66, in update_or_create
obj, created = self.get_or_create(**kwargs)
File "/projects/site/venv/lib/python2.7/site-packages/django/db/models/query.py", line 385, in get_or_create
obj.save(force_insert=True, using=self.db)
File "/projects/site/venv/lib/python2.7/site-packages/django/db/models/base.py", line 460, in save
self.save_base(using=using, force_insert=force_insert, force_update=force_update)
File "/projects/site/venv/lib/python2.7/site-packages/django/db/models/base.py", line 543, in save_base
for f in meta.local_fields if not isinstance(f, AutoField)]
File "/projects/site/venv/lib/python2.7/site-packages/django/db/models/fields/subclassing.py", line 28, in inner
return func(*args, **kwargs)
File "/projects/site/venv/lib/python2.7/site-packages/django/db/models/fields/subclassing.py", line 28, in inner
return func(*args, **kwargs)
File "/projects/site/venv/lib/python2.7/site-packages/django/db/models/fields/__init__.py", line 276, in get_db_prep_save
return self.get_db_prep_value(value, connection=connection, prepared=False)
File "/projects/site/venv/lib/python2.7/site-packages/django/db/models/fields/subclassing.py", line 53, in inner
return func(*args, **kwargs)
File "/projects/site/venv/lib/python2.7/site-packages/picklefield/fields.py", line 154, in get_db_prep_value
value = force_unicode(dbsafe_encode(value, self.compress, self.protocol))
File "/projects/site/venv/lib/python2.7/site-packages/picklefield/fields.py", line 57, in dbsafe_encode
value = b64encode(dumps(deepcopy(value), pickle_protocol))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 190, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 328, in _reconstruct
args = deepcopy(args, memo)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 163, in deepcopy
y = copier(x, memo)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 237, in _deepcopy_tuple
y.append(deepcopy(a, memo))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 190, in deepcopy
y = _reconstruct(x, rv, 1, memo)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 329, in _reconstruct
y = callable(*args)
TypeError: __init__() takes at least 3 arguments (1 given)
Looking at the database calls when this happens, I can see the following queries being executed:
LOG: statement: SELECT "celery_taskmeta"."id", "celery_taskmeta"."task_id", "celery_taskmeta"."status", "celery_taskmeta"."result", "celery_taskmeta"."date_done", "celery_taskmeta"."traceback" FROM "celery_taskmeta" WHERE "celery_taskmeta"."task_id" = 'a950736c-ff93-420c-9fbf-6deb2b88ff4d'
LOG: statement: SAVEPOINT s140735259576672_x4
LOG: statement: ROLLBACK
LOG: statement: BEGIN
LOG: statement: SELECT "celery_taskmeta"."id", "celery_taskmeta"."task_id", "celery_taskmeta"."status", "celery_taskmeta"."result", "celery_taskmeta"."date_done", "celery_taskmeta"."traceback" FROM "celery_taskmeta" WHERE "celery_taskmeta"."task_id" = 'a950736c-ff93-420c-9fbf-6deb2b88ff4d'
LOG: statement: SAVEPOINT s140735259576672_x5
LOG: statement: ROLLBACK
LOG: statement: BEGIN
LOG: statement: SELECT "celery_taskmeta"."id", "celery_taskmeta"."task_id", "celery_taskmeta"."status", "celery_taskmeta"."result", "celery_taskmeta"."date_done", "celery_taskmeta"."traceback" FROM "celery_taskmeta" WHERE "celery_taskmeta"."task_id" = 'a950736c-ff93-420c-9fbf-6deb2b88ff4d'
LOG: statement: SAVEPOINT s140735259576672_x6
I am having a tough time understanding what the source of this invalid object initialization is. Anyone have ideas?
It looks like you are using new-relic remote performance monitoring/forensic analysis. I have seen this kind of problem before when old versions of the library are being used. I recommend checking to make sure you are using the latest version of their client library.
This happened to me and I solved it by reading Python multiprocessing pool hangs at join? and http://bugs.python.org/issue9400.
The problem:
Celery somehow pickles the exceptions it gets and sends them somewhere (to the database/broker, I guess). So, if, at any time, a Celery task raises an exception that isn't pickleable, this bug will happen.
The solution:
You must ensure you're handling all the bizarre exceptions your Celery tasks code might be raising. The Traceback can give you hints, but it may not be very exact about everything.
If you really don't know where are your exceptions coming from, try putting your tasks code inside try...except: pass blocks.

django: can't adapt error when importing data from postgres database

I'm having strange error with installing fixture from dumped data. I am using psycopg2, and django1.1.1
silver:probsbox oleg$ python manage.py loaddata /Users/oleg/probs.json
Installing json fixture '/Users/oleg/probs' from '/Users/oleg/probs'.
Problem installing fixture '/Users/oleg/probs.json': Traceback (most recent call last):
File "/opt/local/lib/python2.5/site-packages/django/core/management/commands/loaddata.py", line 153, in handle
obj.save()
File "/opt/local/lib/python2.5/site-packages/django/core/serializers/base.py", line 163, in save
models.Model.save_base(self.object, raw=True)
File "/opt/local/lib/python2.5/site-packages/django/db/models/base.py", line 495, in save_base
result = manager._insert(values, return_id=update_pk)
File "/opt/local/lib/python2.5/site-packages/django/db/models/manager.py", line 177, in _insert
return insert_query(self.model, values, **kwargs)
File "/opt/local/lib/python2.5/site-packages/django/db/models/query.py", line 1087, in insert_query
return query.execute_sql(return_id)
File "/opt/local/lib/python2.5/site-packages/django/db/models/sql/subqueries.py", line 320, in execute_sql
cursor = super(InsertQuery, self).execute_sql(None)
File "/opt/local/lib/python2.5/site-packages/django/db/models/sql/query.py", line 2369, in execute_sql
cursor.execute(sql, params)
File "/opt/local/lib/python2.5/site-packages/django/db/backends/util.py", line 19, in execute
return self.cursor.execute(sql, params)
ProgrammingError: can't adapt
First I've checked similar issues on internet. This one seemed to be very related: http://code.djangoproject.com/ticket/5996, as my data has many non ASCII symbols
But actually I've checked my django installation and it's ok there
Could you advice what is wrong
====
Continued investigation after added print statement as suggested by the first answer. Log looks this way:
silver:probsbox oleg$ python manage.py loaddata /Users/oleg/probs.json
Installing json fixture '/Users/oleg/probs' from '/Users/oleg/probs'.
<DeserializedObject: Novice>
<DeserializedObject: Junior>
<DeserializedObject: Chess enthusiast>
<DeserializedObject: Experienced player >
<DeserializedObject: Smart player>
Problem installing fixture '/Users/oleg/probs.json': Traceback (most recent call last):
File "/opt/local/lib/python2.5/site-packages/django/core/management/commands/loaddata.py", line 153, in handle
print obj
File "/opt/local/lib/python2.5/site-packages/django/core/serializers/base.py", line 155, in __repr__
return "<DeserializedObject: %s>" % smart_str(self.object)
File "/opt/local/lib/python2.5/site-packages/django/utils/encoding.py", line 107, in smart_str
return str(s)
File "/opt/local/lib/python2.5/site-packages/django/db/models/base.py", line 335, in __str__
return force_unicode(self).encode('utf-8')
File "/opt/local/lib/python2.5/site-packages/django/utils/encoding.py", line 71, in force_unicode
s = unicode(s)
File "/Users/oleg/Sites/probsbox/registration/models.py", line 58, in __unicode__
return u"%s's profile" %(self.user.username)
File "/opt/local/lib/python2.5/site-packages/django/db/models/fields/related.py", line 257, in __get__
rel_obj = QuerySet(self.field.rel.to).get(**params)
File "/opt/local/lib/python2.5/site-packages/django/db/models/query.py", line 305, in get
% self.model._meta.object_name)
DoesNotExist: User matching query does not exist.
silver:probsbox oleg$
Error from very last comment
<DeserializedObject: qwert2000's profile>
Problem installing fixture '/Users/oleg/probs.json': Traceback (most recent call last):
File "/opt/local/lib/python2.5/site-packages/django/core/management/commands/loaddata.py", line 154, in handle
obj.save()
File "/opt/local/lib/python2.5/site-packages/django/core/serializers/base.py", line 163, in save
models.Model.save_base(self.object, raw=True)
File "/opt/local/lib/python2.5/site-packages/django/db/models/base.py", line 495, in save_base
result = manager._insert(values, return_id=update_pk)
File "/opt/local/lib/python2.5/site-packages/django/db/models/manager.py", line 177, in _insert
return insert_query(self.model, values, **kwargs)
File "/opt/local/lib/python2.5/site-packages/django/db/models/query.py", line 1087, in insert_query
return query.execute_sql(return_id)
File "/opt/local/lib/python2.5/site-packages/django/db/models/sql/subqueries.py", line 320, in execute_sql
cursor = super(InsertQuery, self).execute_sql(None)
File "/opt/local/lib/python2.5/site-packages/django/db/models/sql/query.py", line 2369, in execute_sql
cursor.execute(sql, params)
File "/opt/local/lib/python2.5/site-packages/django/db/backends/util.py", line 19, in execute
return self.cursor.execute(sql, params)
ProgrammingError: can't adapt
The can't adapt error is raised by psycopg2 when it receives an data type that it doesn't know how to translate into a value for a SQL statement. For example, if you accidentally pass a list, say, for a value that is supposed to be an integer, psycopg2 will raise this can't adapt error.
The faq.txt document that ships with the source distribution of psycopg2 explains it this way:
Why does !cursor.execute() raise the exception can't adapt?
Psycopg converts Python objects in a SQL string representation by looking
at the object class. The exception is raised when you are trying to pass
as query parameter an object for which there is no adapter registered for
its class. See :ref:adapting-new-types for informations.
Probably your best first-pass at finding the offending value is to run loaddata in fully verbose mode: python manage.py loaddata --verbosity=2 /Users/oleg/probs.json
Well, I was hoping loaddata verbosity would work and I wouldn't have to confess that I've never found an elegant way of debugging adaptation errors with django's loaddata. In the past, I've resorted to inserting print statements in django's loaddata function so that I can see the values being deserialized when the error occurs. I've edited django/core/management/loaddata.py. Look of obj.save() in the handle() function. I hope this confession inspires someone to share a better solution :-)
Ok, I ended copying dump from my database, and restoring it locally without python...