> Issue #173 with patch: > https://github.com/IronLanguages/main/issues/173
> That works for me! I just removed the removal of the slash. I don't > know what that will do for Windows users that had a path that started with > "/". > We distribute our own DLLs, so no rush for a new release. > Thanks! > -Doug > On Tue, Feb 11, 2014 at 4:39 AM, Jeff Hardy <jdha...@gmail.com> wrote: > > On Mon, Feb 10, 2014 at 10:15 PM, Slide <slide.o....@gmail.com> wrote: >> That seems a little odd. Perhaps Jeff can shed some light on it, I think he >> wrote the SQLite adaptation layer. > > I did, but the funny code is part of the C#-sqlite library, which is a > port of the C library to C#. (if you're feeling brave, dig through the > code. It's ... interesting.) It looks like the author just assumed > Windows-ish systems in all cases, and Doug has to go and break > everything by trying to run it on Unix. :( > The file is indeed os_win_c.cs while the original library (http://www.sqlite.org/cgi/src/tree?ci=trunk) has os_unix.c as well. The relevant change in csharp-sqlite is http://code.google.com/p/csharp-sqlite/source/detail?r=2fd39fa5400f6492b97617816c4f20a891b2e432&path=/Community.CsharpSqlite/src/os_win_c.cs with a rather evasive message "Initial 3.7.7 changes". It appears to be a bad port of the original sqlite diff 3.7.6.8->3.7.7 http://www.sqlite.org/cgi/src/fdiff?v1=24d72407a9055196&v2=eafcd6b91cf204a7&sbs=1 with related lines in it ultimately coming from changeset http://www.sqlite.org/cgi/src/info/fe57a8f621 that clearly states "Have the xFullpath method in os_win.c discard the initial "/" if a filename begins with "/X:", where X is any alphabetic character" without explaining the cause. The branch is called `uri' so I guess it's needed to handle URIs like file:///C:/what/ya/mah/call/it.sqlite (Windows kernel APIs treat (and always treated) '/' and '\' the same (http://bytes.com/topic/python/answers/23123-when-did-windows-start-accepting-forward-slash-path-separator )). So, the code was clearly intended for Windows only but ultimately, it's csharp-sqlite's /bydlocode/ that broke things down in this particular case. > I have no idea what that code is trying to do (context: > > https://github.com/IronLanguages/main/blob/master/Languages/IronPython/IronPython.SQLite/c%23sqlite/os_win_c.cs#L2646); > it might be some vestigial part of SQLite that's not needed. Since // > seems OK I'm assuming that's the case. > > Doug, can you open an issue? And in the meantime, is using // an > acceptable workaround? > > - Jeff > >> >> >> On Mon, Feb 10, 2014 at 3:14 PM, Doug Blank <doug.bl...@gmail.com> wrote: >>> >>> That must be the issue, as "//home/dblank/name.db" works: >>> >>> $ ipy.exe >>> IronPython 2.9.9a0 DEBUG (2.9.0.0) on Mono 4.0.30319.1 (64-bit) >>> Type "help", "copyright", "credits" or "license" for more information. >>> >>> import sqlite3 >>> >>> sqlite3.connect("//home/dblank/test.db") >>> <Connection object at 0x000000000000002B> >>> >>> >>> >>> -Doug >>> >>> >>> >>> On Mon, Feb 10, 2014 at 5:12 PM, Doug Blank <doug.bl...@gmail.com> wrote: >>>> >>>> After more testing, it appears that it only fails when the path begins >>>> with a slash "/". >>>> >>>> I see: >>>> >>>> ./c#sqlite/os_win_c.cs: if ( zConverted.StartsWith( "/" ) && >>>> !zConverted.StartsWith( "//" >>>> >>>> I'll try a couple of more things... >>>> >>>> -Doug >>>> >>>> >>>> On Mon, Feb 10, 2014 at 9:19 AM, Doug Blank <doug.bl...@gmail.com> wrote: >>>>> >>>>> >>>>> On Mon, Feb 10, 2014 at 8:47 AM, Slide <slide.o....@gmail.com> wrote: >>>>>> >>>>>> All the connect call does is this: >>>>>> >>>>>> int rc = Sqlite3.sqlite3_open(database, out this.db); >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> if(rc != Sqlite3.SQLITE_OK) >>>>>> throw GetSqliteError(this.db, null); >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> Which makes me thing that sqlite3_open is returning an error code. What >>>>>> happens if you do the same in CPython? >>>>> >>>>> >>>>> No error, creates a file of length 0, and works: >>>>> >>>>> $ python >>>>> Python 2.7.5+ (default, Sep 19 2013, 13:48:49) >>>>> [GCC 4.8.1] on linux2 >>>>> Type "help", "copyright", "credits" or "license" for more information. >>>>> >>> import sqlite3 >>>>> >>> sqlite3.connect("/home/dblank/test.db") >>>>> <sqlite3.Connection object at 0x7fc3c21b6118> >>>>> >>> >>>>> >>>>> $ ls -al /home/dblank/test.db >>>>> -rw-r--r-- 1 dblank dblank 0 Feb 10 09:15 /home/dblank/test.db >>>>> >>>>> -Doug >>>>> >>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Fri, Feb 7, 2014 at 6:01 AM, Doug Blank <doug.bl...@gmail.com> >>>>>> wrote: >>>>>>> >>>>>>> >>>>>>> On Fri, Feb 7, 2014 at 7:47 AM, Slide <slide.o....@gmail.com> wrote: >>>>>>>> >>>>>>>> Do you get a specific error message? >>>>>>> >>>>>>> >>>>>>> Sorry, yes: >>>>>>> >>>>>>> Traceback (most recent call last): >>>>>>> File "<string>", line 1, in <module> >>>>>>> _sqlite3.OperationalError: unable to open database file >>>>>>> >>>>>>> Does this work for you? I get this error running latest ipy.exe (Mono >>>>>>> 2.10, Ubuntu 13.10) and IronPython in Calico. >>>>>>> >>>>>>> -Doug >>>>>>> >>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Fri, Feb 7, 2014 at 5:37 AM, Doug Blank <doug.bl...@gmail.com> >>>>>>>> wrote: >>>>>>>>> >>>>>>>>> Just recently discovered the sqlite3 port for IronPython, but having >>>>>>>>> some basic trouble: >>>>>>>>> >>>>>>>>> This works fine: >>>>>>>>> >>>>>>>>> import sqlite3 >>>>>>>>> sqlite3.connect("test.db") >>>>>>>>> >>>>>>>>> but this doesn't: >>>>>>>>> >>>>>>>>> import sqlite3 >>>>>>>>> sqlite3.connect("/home/dblank/test.db") >>>>>>>>> >>>>>>>>> Any ideas? >>>>>>>>> >>>>>>>>> -Doug >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> Ironpython-users mailing list >>>>>>>>> Ironpython-users@python.org >>>>>>>>> https://mail.python.org/mailman/listinfo/ironpython-users >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Website: http://earl-of-code.com >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Website: http://earl-of-code.com >>>>>> >>>>>> _______________________________________________ >>>>>> Ironpython-users mailing list >>>>>> Ironpython-users@python.org >>>>>> https://mail.python.org/mailman/listinfo/ironpython-users >>>>>> >>>>> >>>> >>> >> >> >> >> -- >> Website: http://earl-of-code.com >> >> _______________________________________________ >> Ironpython-users mailing list >> Ironpython-users@python.org >> https://mail.python.org/mailman/listinfo/ironpython-users >> > -- Best regards, Ivan mailto:v...@mail.mipt.ru _______________________________________________ Ironpython-users mailing list Ironpython-users@python.org https://mail.python.org/mailman/listinfo/ironpython-users