trevorc / timebook

MIT License
0 stars 0 forks source link

`t shell` does not work on paths with spaces #10

Closed trevorc closed 15 years ago

trevorc commented 15 years ago

Original report by Steven Kryskalla (Bitbucket: __stevek, ).


When running t shell on Windows I got this error:

c:\code\timebook>t shell

c:\code\timebook>SQL error: near "and": syntax error

Because the default path to the sqlite db is:

C:\Documents and Settings\username\.config\timebook\sheets.db

The string isn't quoted so sqlite3 sees everything after "C:\Documents" as separate arguments ('and' happens to trigger the "SQL error: near "and": syntax error" message).

Attached is a patch to fix it, but even after you fix it os.execvp behaves oddly on Windows:

c:\code\timebook>t shell

c:\code\timebook>SQLite version 3.5.3
Enter ".help" for instructions
sqlite> .help
'.help' is not recognized as an internal or external command,
operable program or batch file.

Maybe instead of running sqlite3 it would be useful to have t shell run a Python interpreter with all timebook code / model / configs already loaded for you, kinda like what e.g. Werkzeug's manage.py shell command does:

http://werkzeug.pocoo.org/documentation/script

trevorc commented 15 years ago

Original comment by Trevor Caira (Bitbucket: trevor, GitHub: trevor).


Use subprocess.call to spawn sqlite3 -- thanks Alex (fixes #10, #14).