#django

/

      • kyheo joined the channel
      • limbera
        i am trying to write some tests for some models
      • it's a somewhat complicated model in that it creates geos Point fields
      • and i am getting some really strange behaviour in my tests
      • GDAL_ERROR 10: Pointer 'hDS' is NULL in 'GDALClose'.
      • and
      • Exception django.contrib.gis.gdal.error.GDALException: GDALException('Unknown error code: "79982160"',) in ignored
      • jtiai
        limbera: Sounds like broken data you feed in. GDAL is so picky.
      • limbera
        without a line reference or anything - is there a way to make the output of the tests more verbose, so that i can diagnose this problem easier?
      • kyheo has quit
      • jtiai
        GDAL is C-library so there is no lines.
      • shangxiao
        hooly dooly
      • robvdl has quit
      • tulioz has quit
      • limbera
        mmm lame
      • jtiai
        limbera: So you need to verify that you don't feed broken geometries.
      • limbera
        i'm passing in a well formed GPX file
      • and parsing over it
      • and creating Point() fields
      • jtiai
        Print those geoms while you're parsing it, eventually you should see what geom causes the crash.
      • limbera
        well Points() and then creating PointFields from that
      • right
      • the code works in production, i'm just trying to write some tests
      • so i think the problem isn't necessarily with my file
      • and more with the way i'm setting up this test environmen
      • *environmeny
      • jtiai
        Oh, then - do you have same version of GDAL in both environments?
      • limbera
        mmm i am not entirely sure
      • runserver locally, and uploading the file through my views etc.. works fine
      • but the python test ... results in those other errors
      • *but then
      • is it possibly to do with postgis in the test database?
      • jtiai
        If version differs, yes.
      • hamub joined the channel
      • limbera
        do i need to do anything to install it in a test env?
      • that should be handled by my migrations
      • jtiai
        Error you get refers to datasource...
      • the_drow joined the channel
      • So it looks like gdal is trying to close datasource that has null handle.
      • limbera
        hmm i see
      • jtiai
        And that usually means that some code is trying to close GDAL datasource that failed to open (returned null (or None))
      • rnd_gen has quit
      • sieve has quit
      • limbera
        i see
      • that does make sense
      • let me do some debugging
      • bayman has quit
      • strange, the problem seems to occur without any of my test code executing anyway
      • what i mean by that, is if i comment out my entire test file code, and try run the tests
      • it outputs this: GDAL_ERROR 10: Pointer 'hDS' is NULL in 'GDALClose'.
      • directly after "Creating test database for alias 'default'..."
      • it is failing during the db's creation
      • found it
      • -v 2
      • one of the migrations is failing
      • jtiai
        Really?
      • limbera
        not sure if it fails, but when it runs it outputs this
      • miz- joined the channel
      • the_drow joined the channel
      • jtiai
        Wonder what black magic happens there that causes crash...
      • workbean joined the channel
      • limbera
      • with the sections i believe are causing the error
      • zeioth joined the channel
      • pyface has quit
      • the_drow joined the channel
      • jtiai
        I don't see any fishy there, so yo may want try to create minimal test case that does the same thing and see if it crashes as well.
      • It could be a bug.
      • limbera
        im gonna make a new db and just try run migrations manually
      • outside of test db
      • see what happens
      • yep
      • error
      • same error's that is
      • strange, i think this must be related to django 1.10
      • unsure though
      • Cliff` has quit
      • mariusp joined the channel
      • mine0901 joined the channel
      • _1k5 joined the channel
      • whaack joined the channel
      • whaack has quit
      • Cliff` joined the channel
      • nimomo joined the channel
      • space-wizard has quit
      • michalmo joined the channel
      • space-wizard joined the channel
      • tuxtoti has quit
      • Cliff` has quit
      • tuxtoti joined the channel
      • renlo joined the channel
      • renlo has quit
      • Cliff` joined the channel
      • -- BotBot disconnected, possible missing messages --
      • [o__o] joined the channel
      • mitaka joined the channel
      • foxmask
        o/
      • Stragler
        Hello. If I have a class in models.py called Thing(models.Model) and it has a function: def Function(self): is it then possible to use Thing.objects and then iterate over it?
      • I am trying to do so in the shell, but It is not possible ofr some reason. Can not iterate over a Manager..
      • wili has quit
      • For example: I created an object with my class, I then want to count how many of those objects from that class I have. I want to do this with a function the class already has, and thus the objects. How do I do this??
      • kyheo joined the channel
      • shangxiao
        Stragler: you can't iterate over a manager, only a resultset
      • mehola has quit
      • so it's Thing.objects.all()
      • or Thing.objects.filter(filters…)
      • celefthe joined the channel
      • hm queryset*…
      • slav0nic joined the channel
      • sol1x has quit
      • Stragler
        So how can I count the objects then?
      • nwp has quit
      • shangxiao
      • Stragler
        I triet Thing.objects.all.count()
      • did not work
      • shangxiao
        yes, pls read that link
      • the example
      • Stragler
        Entry.objects.count() doesnt work either
      • shangxiao
        do you have a model "Entry"?
      • i thought you had "Thing" ?
      • Stragler
        Thing
      • I jsut copy pasted example
      • but I tried it
      • doesnt work
      • shangxiao
        why would you copy n paste the example?
      • Stragler
        django.db.utils.OperationalError: no such table: WebApp_trip
      • shangxiao
        i dunno kids these days want to program everything by copy n paste ;)
      • Stragler
        Noooooo, I did Thing.objects.count()
      • shangxiao
        that's not what you just said
      • Stragler
        it did not work. I just copy pasted the example in order to tell you I also tried that compination, without the all()
      • Sorry for the confusion
      • shangxiao
        ok so "no such table" means you haven't migrated, usually
      • at this point i feel i should ask the old "Have you done the tutorial?" question
      • Stragler
        I am doing this shit in the shell
      • mine0901
        Hello, I have a django app in which i want to take users' xml link of blogs and from that display latest entries on my blog page. Any ideas, Help!!
      • Stragler
        Do I have to migrade everytime I make a change, even in the shell?
      • shangxiao
        Stragler: please refrain from cursing, if you want help
      • mariusp has quit
      • Stragler
        ok
      • shangxiao
        Stragler: so you need to migrate every time you make a change to a model
      • Stragler
        Can I do this in the shell?
      • shangxiao
        and "no such table" means that migrate has never been run for the app that has that model
      • Stragler
        Or do I need to exit the shell every single time?
      • Yeah I know. I just wanna play around without having to make the db yet
      • Thats what the shell was for, I thought
      • shangxiao
        yeah you can't define models in the shell, unfortunately
      • well you can, but they won't "work"
      • as they need a db backing them
      • jessamynsmith joined the channel