Re: [sqlalchemy] unable to open database file
no but this is more of a pysqlite/sqlite3 issue, you should ask on the Python users list, and refer to the sqlite3.connect() function: import sqlite3 conn = sqlite3.connect(/path/to/file.db) On 6/19/14, 2:28 PM, Scott Horowitz wrote: Hi, A user of my applicable is getting a unable to open database file None None error because the file path to their database has a Á character in it. It works fine if the character is removed, but that is not a good solution. Does anyone know how to solve this? Thanks, Scott -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com mailto:sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com mailto:sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] unable to open database file
Michael, Thanks for the hint about python's sqlite3. I'll just point out that I can work around the issue directly with sqlite3 by providing a relative path that does not include the character: import sqlite3, os os.chdir(/path/with/non/ascii/character) conn = sqlite3.connect(file.db) However if I take this same approach with sqlalchemy, it does not fix the issue. It appears that this is because sqlalchemy always provides the absolute path to sqlite3. If I comment out these lines in sqlalchemy/dialects/sqlite/pysqlite.py's create_connect_args() method, then the above workaround works: if filename != ':memory:': filename = os.path.abspath(filename) I am going to file a bug report to see if this should/could be changed (I'm not sure if there are any downsides to removing these lines). Scott On Thursday, June 19, 2014 12:48:57 PM UTC-6, Michael Bayer wrote: no but this is more of a pysqlite/sqlite3 issue, you should ask on the Python users list, and refer to the sqlite3.connect() function: import sqlite3 conn = sqlite3.connect(/path/to/file.db) On 6/19/14, 2:28 PM, Scott Horowitz wrote: Hi, A user of my applicable is getting a unable to open database file None None error because the file path to their database has a Á character in it. It works fine if the character is removed, but that is not a good solution. Does anyone know how to solve this? Thanks, Scott -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com javascript:. To post to this group, send email to sqlal...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] unable to open database file
On 6/19/14, 3:37 PM, Scott Horowitz wrote: Michael, Thanks for the hint about python's sqlite3. I'll just point out that I can work around the issue directly with sqlite3 by providing a relative path that does not include the character: import sqlite3, os os.chdir(/path/with/non/ascii/character) conn = sqlite3.connect(file.db) However if I take this same approach with sqlalchemy, it does not fix the issue. It appears that this is because sqlalchemy always provides the absolute path to sqlite3. well if sqlite3.connect(os.path.abspath(relative/path)) is failing, that's something for the Python core / SQLite folks regardless. if you need a workaround right now you can pass creator to the engine: e = create_engine(sqlite://, creator=lambda: sqlite3.connect(whatever)) -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] unable to open database file
Ah great, that is much better than having to modify sqlalchemy code. Indeed, the below code works for me: os.chdir(os.path.dirname(db_path)) e = create_engine(sqlite:///, creator=lambda: sqlite3.connect(os.path.basename(db_path))) Thanks! Scott On Thu, Jun 19, 2014 at 2:09 PM, Mike Bayer mike...@zzzcomputing.com wrote: On 6/19/14, 3:37 PM, Scott Horowitz wrote: Michael, Thanks for the hint about python's sqlite3. I'll just point out that I can work around the issue directly with sqlite3 by providing a relative path that does not include the character: import sqlite3, os os.chdir(/path/with/non/ascii/character) conn = sqlite3.connect(file.db) However if I take this same approach with sqlalchemy, it does not fix the issue. It appears that this is because sqlalchemy always provides the absolute path to sqlite3. well if sqlite3.connect(os.path.abspath(relative/path)) is failing, that's something for the Python core / SQLite folks regardless. if you need a workaround right now you can pass creator to the engine: e = create_engine(sqlite://, creator=lambda: sqlite3.connect(whatever)) -- You received this message because you are subscribed to a topic in the Google Groups sqlalchemy group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/sqlalchemy/Q6dAkM0y0Yo/unsubscribe. To unsubscribe from this group and all its topics, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.