On 27/01/2011 1:02pm, Casual Coder wrote:
Thanks Mike.

But Darn I'm not as powerful as I had hoped.   I expected DUMPDATA to
work the same way, but it doesn't.   How did VERSION work?

VERSION didn't actually "work". It is a constant which is an attribute of django. Bear in mind that django is just python code.

You can import anything from the django python package using dot notation. That includes constants in __init__.py.

I just had a look in there and see now why you were trying to call get_version(). The correct way to do that is ...

>>> import django
>>> django.get_version()
u'1.3 alpha 1 SVN-14914'
>>>

or

>>> from django import get_version
>>> get_version()
u'1.3 alpha 1 SVN-14914'
>>>


and why doesn't django-admin.py dumpdata work?

Because that isn't how python code works. Within the interpreter (and in your code) you need to import packages or modules without mentioning the .py file extension. Python relies on finding things via the python path and dot notation.

Try getting a shell command line or Windows DOS prompt and do ...

python django-admin.py dumpdata

hth

M




django-admin.py dumpdata
   File "<console>", line 1
     django-admin.py dumpdata
                            ^
SyntaxError: invalid syntax
print 'darn'
darn


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to