3

I've already posed a question about this a few days ago. The question was unnoticed, I suppose, but the behavior is really strange so I'm trying to reduce it to simpler elements and asking again.

please look at this traceback:

Traceback (most recent call last):
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 114, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/utils/decorators.py", line 29, in _wrapper
    return bound_func(*args, **kwargs)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/utils/decorators.py", line 25, in bound_func
    return func(self, *args2, **kwargs2)
  File "/home/m2user/webapps/enea/src/django-geojson/djgeojson/views.py", line 51, in dispatch
    return super(GeoJSONLayerView, self).dispatch(*args, **kwargs)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/views/generic/list.py", line 153, in get
    return self.render_to_response(context)
  File "/home/m2user/webapps/enea/src/django-geojson/djgeojson/views.py", line 41, in render_to_response
    **options)
  File "/home/m2user/webapps/enea/src/django-geojson/djgeojson/serializers.py", line 335, in serialize
    self.serialize_object_list(queryset)
  File "/home/m2user/webapps/enea/src/django-geojson/djgeojson/serializers.py", line 277, in serialize_queryset
    self.start_object(obj)
  File "/home/m2user/webapps/enea/src/django-geojson/djgeojson/serializers.py", line 177, in handle_field
    if value is not None:
  File "/home/m2user/webapps/enea/src/django-geojson/djgeojson/serializers.py", line 159, in _handle_geom
    #logger.warn('%s != '%(self.srid, geometry.srid))
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/contrib/gis/geos/geometry.py", line 510, in transform
    raise GEOSException("Calling transform() with no SRID set is not supported")

how can line 159 generate such error? It's a comment!

What tried so far: I've deleted all .pyc files and restarted gunicorn before querying the view that generates this error. In source code (django-geojson lib) there is no other call to transform() function (I commented them all).

any ideas?

UPDATE: I was able to solve my issue by uninstalling and then re-installing all the libraries (as ubuntu packages), the python interpreter, all the code, by re-generating the database (including reinstalling postgis) and then by completely restart nginx (and thus gunicorn). No libraries were updated, however, so I still do not understand what really happened.

Community
  • 1
  • 1
furins
  • 4,979
  • 1
  • 39
  • 57
  • Have you analyzed this line 159 in serializers? Maybe the traceback is simply inaccurate for some reasons. – Pawel Miech Feb 02 '14 at 18:06
  • @Pawelmhm yes, I did. The line was exactly the same (actually I commented it in order to check if that line was really generating the error) – furins Feb 02 '14 at 19:27
  • Can you add e.g. a print statement to the serializers.py file so you can be sure that that file is actually used? If you add it somewhere in the beginning of the file, you should see the output on stdout and the exception should move from line 159 to 160. If neither happens, then the source in the Traceback is not accurate. – bohrax Feb 02 '14 at 19:28
  • @bohrax I really believe that the traceback is inaccurate, but if I add a print statement the exception moves to the next line as expected (I've already tried) and the error remains, exactly the same. – furins Feb 02 '14 at 19:32
  • 1
    Do you still have the offending transform() function call at line 159? What about adding some statements which prints the current line number before and after the problematic line? http://stackoverflow.com/questions/6810999/how-to-determine-file-function-and-line-number – bohrax Feb 02 '14 at 19:50
  • @bohrax thank you for pointing me to inspect. I solved the problem with brute force since I was in hurry - I'll take in account your advice next time something similar will happen again O.O – furins Feb 03 '14 at 19:44

1 Answers1

1

You might want to go through the discussion here if you have not already. https://github.com/makinacorpus/django-geojson/pull/11

Anup
  • 743
  • 6
  • 12
  • thank you - I was aware of that pull request but it didn't solve the issue. I forked the code and tried several times to generate a workaround (https://github.com/furins/django-geojson) but the error remained, and only on production server. I ended with a similar code, but at the very end I solved the issue by re-installing almost everything. – furins Feb 02 '14 at 19:42