On 3/4/11, Karen Tracey <kmtra...@gmail.com> wrote: > On Wed, Mar 2, 2011 at 4:43 PM, Alex Hall <mehg...@gmail.com> wrote: > >> Well, looks like things are suddenly working. I started over, and >> changed two things: I removed the path from the database file name and >> I gave it an extension of .db. The file appeared in the same place as >> before, so my path was right, but the .db extension seems to have made >> something quite happy as things are now working quite nicely. >> > > Traceback shows you are working on Windows -- were you specifying the path > with single backslashes? If so, that's likely the problem. If one of the > single backslashes was interpreted as an escape sequence (see the table > under: > http://docs.python.org/reference/lexical_analysis.html#string-literals) then > your path specification was essentially corrupted by Python's interpretation > of the string literal, and SQLite was passed a name for a DB that it could > not open (too bad it doesn't include that name in its error message, since > that would be a good aid in figuring out problems like this). Yes, that would be helpful. I was using single forward slashes, though, and I did get a file created, it just then said it could not open it. For whatever reason, adding the .db extension seems to have done the trick. > > When specifying paths in Python code on Windows, it's best to use forward > slashes. They are interpreted correctly and avoid this problem with > backslashes in string literals. (You can also double the backslashes or > specify the string a raw with the r prefix, but in general I find it easier > to just always use forward slashes for the path separator.) I usually use raw strings. I never knew you could use forward slashes on Windows, since shell prompts always require backslashes. This is really good to know! > > Karen > -- > http://tracey.org/kmt/ > > -- > 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. > >
-- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap -- 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.