Ticket #567 (closed defect: fixed)
Logging causes error in python2.4
| Reported by: | alexander.j.robbins@… | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | 0.7.3 |
| Component: | migrations | Version: | unknown |
| Keywords: | python2.4 | Cc: |
Description
The logging module in python2.4 doesn't accept the 'extra' kwarg. It is used here:
http://south.aeracode.org/browser/south/db/generic.py#L129
This causes all migrations to fail with an exception. The 'extra' kwarg might be used other places too, not sure. This is where it is making trouble for me.
Thanks!
Alex
Attachments
Change History
comment:1 Changed 3 years ago by andrew
- Status changed from new to infoneeded
- Milestone set to 0.7.3
comment:2 Changed 3 years ago by alexander.j.robbins@…
- Status changed from infoneeded to assigned
Don't have the code running right now, but I think it was:
Unrecognized kwarg: 'extra'
or something like that.
comment:3 Changed 3 years ago by anonymous
Here is an example exception:
south.exceptions.FailedDryRun: ! Error found during dry run of '0001_initial'! Aborting.
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/South-0.7.2-py2.4.egg/south/migration/migrators.py", line 164, in _run_migration
migration_function()
File "/usr/lib/python2.4/site-packages/South-0.7.2-py2.4.egg/south/migration/migrators.py", line 57, in <lambda>
return (lambda: direction(orm))
File "/opt/RNH/main/migrations/0001_initial.py", line 12, in forwards
db.create_table('main_directindial', (
File "/usr/lib/python2.4/site-packages/South-0.7.2-py2.4.egg/south/db/generic.py", line 211, in create_table
self.execute('CREATE TABLE %s (%s);' % (
File "/usr/lib/python2.4/site-packages/South-0.7.2-py2.4.egg/south/db/generic.py", line 129, in execute
get_logger().debug('south execute "%s" with params "%s"' % (sql, params), extra={
File "/usr/lib64/python2.4/logging/__init__.py", line 955, in debug
apply(self._log, (DEBUG, msg, args), kwargs)
TypeError: _log() got an unexpected keyword argument 'extra'
This will be a big problem for anyone who wants to use South on RHEL or CentOS, such as myself.
comment:4 Changed 3 years ago by alan@…
Hi,
I get the same on CentOS with python 2.4, but only since upgrading from 0.7.1 to 0.7.2.
Looking at the code I can see that the extra kwarg wasn't in 0.7.1 and I can't see why you've got it in 0.7.2 as you add the info direct in the log message anyway and it doesn't look like you use the extra dict to populate the LogRecord?'s FORMAT string?
just removing the extra kwarg from the call in generic.py line 129 fixes the migrate command for me and although I haven't checked the logging output I'm confident that, since you insert the same data (sql and params) into the message anyway, the log message will hold the relavant info.
Cheers,
Alan.
comment:5 Changed 3 years ago by andrew
- Status changed from assigned to closed
- Resolution set to fixed
Alright, I've undone that change in [b4854b03c826] - I didn't realise extra wasn't in 2.4!
comment:6 Changed 3 years ago by rsolomon@…
So this means no migrations will work in version 0.7.2 on python 2.4? Any idea when this fix will make it into a release?
thanks!
Rory
comment:7 Changed 3 years ago by andrew
Indeed; a release will happen sooner or later, but in the meantime, you can run off of the default branch in mercurial; we have a keep-default-stable policy.
comment:8 Changed 3 years ago by rsolomon@…
holy cow lightning response.
Unfortunately I'm running on an older system (hence python 2.4) and can't install mercurial. I'm planning on installing 0.7.1 unless you think that will be a problem.
thanks!
comment:9 Changed 3 years ago by andrew
Well, in that case use the magical tarball of default for now (one good reason we host on BitBucket?):

That's annoying; there's not really any way around that, either. What's the exception it's failing with?