5:30 AM
kyheo joined the channel
5:34 AM
limbera
i am trying to write some tests for some models
5:34 AM
it's a somewhat complicated model in that it creates geos Point fields
5:34 AM
and i am getting some really strange behaviour in my tests
5:34 AM
GDAL_ERROR 10: Pointer 'hDS' is NULL in 'GDALClose'.
5:35 AM
and
5:35 AM
Exception django.contrib.gis.gdal.error.GDALException: GDALException('Unknown error code: "79982160"',) in ignored
5:35 AM
jtiai
limbera: Sounds like broken data you feed in. GDAL is so picky.
5:35 AM
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?
5:35 AM
kyheo has quit
5:35 AM
jtiai
GDAL is C-library so there is no lines.
5:35 AM
shangxiao
hooly dooly
5:35 AM
robvdl has quit
5:36 AM
tulioz has quit
5:36 AM
limbera
mmm lame
5:36 AM
jtiai
limbera: So you need to verify that you don't feed broken geometries.
5:36 AM
limbera
i'm passing in a well formed GPX file
5:37 AM
and parsing over it
5:37 AM
and creating Point() fields
5:37 AM
jtiai
Print those geoms while you're parsing it, eventually you should see what geom causes the crash.
5:37 AM
limbera
well Points() and then creating PointFields from that
5:37 AM
right
5:38 AM
the code works in production, i'm just trying to write some tests
5:38 AM
so i think the problem isn't necessarily with my file
5:38 AM
and more with the way i'm setting up this test environmen
5:38 AM
*environmeny
5:38 AM
jtiai
Oh, then - do you have same version of GDAL in both environments?
5:39 AM
limbera
mmm i am not entirely sure
5:40 AM
runserver locally, and uploading the file through my views etc.. works fine
5:40 AM
but the python test ... results in those other errors
5:40 AM
*but then
5:40 AM
is it possibly to do with postgis in the test database?
5:41 AM
jtiai
If version differs, yes.
5:41 AM
hamub joined the channel
5:42 AM
limbera
do i need to do anything to install it in a test env?
5:42 AM
that should be handled by my migrations
5:42 AM
jtiai
Error you get refers to datasource...
5:42 AM
the_drow joined the channel
5:42 AM
So it looks like gdal is trying to close datasource that has null handle.
5:43 AM
limbera
hmm i see
5:44 AM
jtiai
And that usually means that some code is trying to close GDAL datasource that failed to open (returned null (or None))
5:44 AM
rnd_gen has quit
5:44 AM
sieve has quit
5:45 AM
limbera
i see
5:45 AM
that does make sense
5:45 AM
let me do some debugging
5:46 AM
bayman has quit
5:48 AM
strange, the problem seems to occur without any of my test code executing anyway
5:49 AM
what i mean by that, is if i comment out my entire test file code, and try run the tests
5:49 AM
it outputs this: GDAL_ERROR 10: Pointer 'hDS' is NULL in 'GDALClose'.
5:49 AM
directly after "Creating test database for alias 'default'..."
5:49 AM
it is failing during the db's creation
5:50 AM
found it
5:50 AM
-v 2
5:50 AM
one of the migrations is failing
5:50 AM
jtiai
Really?
5:50 AM
limbera
not sure if it fails, but when it runs it outputs this
5:51 AM
5:51 AM
miz- joined the channel
5:51 AM
the_drow joined the channel
5:52 AM
jtiai
Wonder what black magic happens there that causes crash...
5:52 AM
workbean joined the channel
5:52 AM
limbera
5:52 AM
with the sections i believe are causing the error
5:53 AM
zeioth joined the channel
5:56 AM
pyface has quit
5:56 AM
the_drow joined the channel
5:56 AM
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.
5:56 AM
It could be a bug.
5:57 AM
limbera
im gonna make a new db and just try run migrations manually
5:57 AM
outside of test db
5:57 AM
see what happens
5:57 AM
yep
5:57 AM
error
5:58 AM
same error's that is
5:58 AM
strange, i think this must be related to django 1.10
5:58 AM
unsure though
6:01 AM
Cliff` has quit
6:01 AM
mariusp joined the channel
6:03 AM
mine0901 joined the channel
6:03 AM
_1k5 joined the channel
6:04 AM
whaack joined the channel
6:04 AM
whaack has quit
6:06 AM
Cliff` joined the channel
6:07 AM
nimomo joined the channel
6:12 AM
space-wizard has quit
6:12 AM
michalmo joined the channel
6:12 AM
space-wizard joined the channel
6:13 AM
tuxtoti has quit
6:13 AM
Cliff` has quit
6:13 AM
tuxtoti joined the channel
6:14 AM
renlo joined the channel
6:14 AM
renlo has quit
6:15 AM
Cliff` joined the channel
6:18 AM
-- BotBot disconnected, possible missing messages --
6:20 AM
[o__o] joined the channel
6:20 AM
mitaka joined the channel
6:21 AM
foxmask
o/
6:22 AM
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?
6:23 AM
I am trying to do so in the shell, but It is not possible ofr some reason. Can not iterate over a Manager..
6:23 AM
wili has quit
6:24 AM
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??
6:25 AM
kyheo joined the channel
6:25 AM
shangxiao
Stragler: you can't iterate over a manager, only a resultset
6:25 AM
mehola has quit
6:25 AM
so it's Thing.objects.all()
6:25 AM
or Thing.objects.filter(filters…)
6:27 AM
celefthe joined the channel
6:28 AM
hm queryset*…
6:30 AM
slav0nic joined the channel
6:31 AM
sol1x has quit
6:32 AM
Stragler
So how can I count the objects then?
6:32 AM
nwp has quit
6:32 AM
shangxiao
6:33 AM
Stragler
I triet Thing.objects.all.count()
6:33 AM
did not work
6:33 AM
shangxiao
yes, pls read that link
6:33 AM
the example
6:34 AM
Stragler
Entry.objects.count() doesnt work either
6:35 AM
shangxiao
do you have a model "Entry"?
6:35 AM
i thought you had "Thing" ?
6:35 AM
Stragler
Thing
6:36 AM
I jsut copy pasted example
6:36 AM
but I tried it
6:36 AM
doesnt work
6:36 AM
shangxiao
why would you copy n paste the example?
6:36 AM
Stragler
django.db.utils.OperationalError: no such table: WebApp_trip
6:36 AM
shangxiao
i dunno kids these days want to program everything by copy n paste ;)
6:37 AM
Stragler
Noooooo, I did Thing.objects.count()
6:37 AM
shangxiao
that's not what you just said
6:37 AM
Stragler
it did not work. I just copy pasted the example in order to tell you I also tried that compination, without the all()
6:37 AM
Sorry for the confusion
6:38 AM
shangxiao
ok so "no such table" means you haven't migrated, usually
6:38 AM
at this point i feel i should ask the old "Have you done the tutorial?" question
6:39 AM
Stragler
I am doing this shit in the shell
6:39 AM
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!!
6:39 AM
Stragler
Do I have to migrade everytime I make a change, even in the shell?
6:40 AM
shangxiao
Stragler: please refrain from cursing, if you want help
6:40 AM
mariusp has quit
6:40 AM
Stragler
ok
6:40 AM
shangxiao
Stragler: so you need to migrate every time you make a change to a model
6:40 AM
Stragler
Can I do this in the shell?
6:40 AM
shangxiao
and "no such table" means that migrate has never been run for the app that has that model
6:40 AM
Stragler
Or do I need to exit the shell every single time?
6:41 AM
Yeah I know. I just wanna play around without having to make the db yet
6:41 AM
Thats what the shell was for, I thought
6:41 AM
shangxiao
yeah you can't define models in the shell, unfortunately
6:41 AM
well you can, but they won't "work"
6:41 AM
as they need a db backing them
6:42 AM
jessamynsmith joined the channel