Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The example in "APSW - Another Python SQLite Wrapper" fails under Windows #1

Closed
rogerbinns opened this issue Dec 29, 2013 · 2 comments
Assignees

Comments

@rogerbinns
Copy link
Owner

From rogerbinns on March 10, 2008 01:58:18

(pysqlite ticket 192)

apsw Example on http://initd.org/pub/software/pysqlite/apsw/3.3.13-r1/apsw.html Has a bug when run under Windows. This bug is caused by the conflict
between Windows use of backslash () as the path separator and Python's use
of forwardslash (/) as the path separator.

with line: sysdirs=",".join(["'%s'" % (x,) for x in sys.path[1:] if len(x)
and os.path.isdir(x)]) The execution error terminates with the tail of its
output as follows:

no commits out of hours commit was not allowed

Traceback (most recent call last):

File "D:\Python\00 Projects\IRR\apswTest.py", line 342, in -toplevel-

    cursor.execute("create virtual table sysfiles using

filesource("+sysdirs+")")

File "apsw.c", line 3518, in resetcursor File "apsw.c", line 2460, in

VirtualTable?.xCreate File "D:\Python\00 Projects\IRR\apswTest.py", line
291, in Create

    columns,data=getfiledata([eval(a) for a in args]) # eval strips off

layer of quotes

File "D:\Python\00 Projects\IRR\apswTest.py", line 278, in getfiledata

    for f in os.listdir(directory):

WindowsError?: [Errno 123] The filename, directory name, or volume label
syntax is incorrect: 'C:\x08in\Python24\Lib\idlelib/.'

with line: sysdirs=",".join(["'%s'" % (x.replace('','/'),) for x in
sys.path[1:] if len(x) and os.path.isdir(x)]) The execution terminates
normally without error.

Original issue: http://code.google.com/p/apsw/issues/detail?id=1

@ghost ghost assigned rogerbinns Dec 29, 2013
@rogerbinns
Copy link
Owner Author

From rogerbinns on May 29, 2008 21:21:19

Incidentally the actual cause is the eval line where I wanted quotes removed as
appropriate but backslashes needed to be doubled up. Eg if the string was (including
the double quotes) "c:\new\run.txt" then the eval was removing the quotes, but also
expanding the \n and \r. The fix is to double up the backslashes before running eval.

@rogerbinns
Copy link
Owner Author

From rogerbinns on May 29, 2008 21:24:19

Fix committed in r153

Status: Verified

rogerbinns added a commit that referenced this issue Oct 7, 2024
You'll need a wide window to read this

This is the backtrace on Ubuntu 24.10 with Python 3.12.7 - it has occurred on versions too

Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
#0  0x00007ffff7c6c804 in __printf_buffer (buf=buf@entry=0x7fffff7ff240, format=0x71cdf5 "%zd", ap=0x7fffff7ff290, mode_flags=6) at ./stdio-common/vfprintf-internal.c:600
#1  0x00007ffff7c8dc93 in __vsprintf_internal (string=string@entry=0x7fffff7ff430 "", maxlen=maxlen@entry=26, format=<optimised out>, args=args@entry=0x7fffff7ff290, mode_flags=mode_flags@entry=6) at ./libio/iovsprintf.c:62
#2  0x00007ffff7d4228f in ___sprintf_chk (s=s@entry=0x7fffff7ff430 "", flag=flag@entry=2, slen=slen@entry=26, format=<optimised out>) at ./debug/sprintf_chk.c:40
#3  0x00000000005abf85 in sprintf (__s=<optimised out>, __fmt=<optimised out>) at /usr/include/x86_64-linux-gnu/bits/stdio2.h:30
#4  unicode_fromformat_arg (writer=0x7fffff7ff3f0, f=0x71cdf7 "d", vargs=0x7fffff7ff3d8) at ../Objects/unicodeobject.c:2740
#5  PyUnicode_FromFormatV (format=<optimised out>, vargs=vargs@entry=0x7fffff7ff4a8) at ../Objects/unicodeobject.c:2963
#6  0x00000000005b3c6f in PyUnicode_FromFormat (format=format@entry=0x71cdf5 "%zd") at ../Objects/unicodeobject.c:3011
#7  0x00000000005d7a3e in too_many_positional (co=<optimised out>, tstate=0xbae310 <_PyRuntime+458992>, given=2, defaults=<optimised out>, localsplus=0x7ffff7fb0cb0, qualname='APSW.testIssue425.<locals>.handler') at ../Python/ceval.c:1150
#8  initialize_locals (tstate=tstate@entry=0xbae310 <_PyRuntime+458992>, func=func@entry=0x7fffe9094ae0, localsplus=<optimised out>, args=<optimised out>, argcount=<optimised out>, kwnames=<optimised out>) at ../Python/ceval.c:1459
#9  0x00000000005d7642 in _PyEvalFramePushAndInit (tstate=0xbae310 <_PyRuntime+458992>, func=0x7fffe9094ae0, locals=<optimised out>, args=0x7fffff7ff708, argcount=<optimised out>, kwnames=0x0) at ../Python/ceval.c:1594
#10 _PyEval_Vector (tstate=0xbae310 <_PyRuntime+458992>, func=0x7fffe9094ae0, locals=<optimised out>, args=0x7fffff7ff708, argcount=2, kwnames=0x0) at ../Python/ceval.c:1677
#11 0x000000000054a2d5 in _PyObject_VectorcallTstate (tstate=0xbae310 <_PyRuntime+458992>, callable=<function at remote 0x7fffe9094ae0>, args=<optimised out>, nargsf=<optimised out>, kwnames=<optimised out>) at ../Include/internal/pycore_call.h:92
#12 PyObject_Vectorcall (callable=<function at remote 0x7fffe9094ae0>, args=<optimised out>, nargsf=<optimised out>, kwnames=<optimised out>) at ../Objects/call.c:325
#13 0x00007fffe96aa94c in apsw_logger (arg=0x7fffe9094ae0, errcode=1, message=0x7fffff7ff770 "apsw_write_unraisable TypeError: APSW.testIssue425.<locals>.handler() takes 0 positional arguments but 2 were given") at src/apsw.c:447
#14 0x00007fffe945ece4 in renderLogMsg (iErrCode=1, zFormat=0x7fffe96ce958 "apsw_write_unraisable %s: %s", ap=0x7fffff7ff880) at sqlite3/sqlite3.c:32459
#15 0x00007fffe945edfa in sqlite3_log (iErrCode=1, zFormat=0x7fffe96ce958 "apsw_write_unraisable %s: %s") at sqlite3/sqlite3.c:32470
#16 0x00007fffe95d903a in apsw_write_unraisable (hookobject=0x0) at src/util.c:174
#17 0x00007fffe96aaaf1 in apsw_logger (arg=0x7fffe9094ae0, errcode=1, message=0x7fffff7ffbc0 "apsw_write_unraisable TypeError: APSW.testIssue425.<locals>.handler() takes 0 positional arguments but 2 were given") at src/apsw.c:464
#18 0x00007fffe945ece4 in renderLogMsg (iErrCode=1, zFormat=0x7fffe96ce958 "apsw_write_unraisable %s: %s", ap=0x7fffff7ffcd0) at sqlite3/sqlite3.c:32459
#19 0x00007fffe945edfa in sqlite3_log (iErrCode=1, zFormat=0x7fffe96ce958 "apsw_write_unraisable %s: %s") at sqlite3/sqlite3.c:32470
#20 0x00007fffe95d903a in apsw_write_unraisable (hookobject=0x0) at src/util.c:174
#21 0x00007fffe96aaaf1 in apsw_logger (arg=0x7fffe9094ae0, errcode=1, message=0x7fffff800010 "apsw_write_unraisable TypeError: APSW.testIssue425.<locals>.handler() takes 0 positional arguments but 2 were given") at src/apsw.c:464
#22 0x00007fffe945ece4 in renderLogMsg (iErrCode=1, zFormat=0x7fffe96ce958 "apsw_write_unraisable %s: %s", ap=0x7fffff800120) at sqlite3/sqlite3.c:32459
#23 0x00007fffe945edfa in sqlite3_log (iErrCode=1, zFormat=0x7fffe96ce958 "apsw_write_unraisable %s: %s") at sqlite3/sqlite3.c:32470
#24 0x00007fffe95d903a in apsw_write_unraisable (hookobject=0x0) at src/util.c:174
#25 0x00007fffe96aaaf1 in apsw_logger (arg=0x7fffe9094ae0, errcode=1, message=0x7fffff800460 "apsw_write_unraisable TypeError: APSW.testIssue425.<locals>.handler() takes 0 positional arguments but 2 were given") at src/apsw.c:464
#26 0x00007fffe945ece4 in renderLogMsg (iErrCode=1, zFormat=0x7fffe96ce958 "apsw_write_unraisable %s: %s", ap=0x7fffff800570) at sqlite3/sqlite3.c:32459
#27 0x00007fffe945edfa in sqlite3_log (iErrCode=1, zFormat=0x7fffe96ce958 "apsw_write_unraisable %s: %s") at sqlite3/sqlite3.c:32470
#28 0x00007fffe95d903a in apsw_write_unraisable (hookobject=0x0) at src/util.c:174
#29 0x00007fffe96aaaf1 in apsw_logger (arg=0x7fffe9094ae0, errcode=1, message=0x7fffff8008b0 "apsw_write_unraisable TypeError: APSW.testIssue425.<locals>.handler() takes 0 positional arguments but 2 were given") at src/apsw.c:464
#30 0x00007fffe945ece4 in renderLogMsg (iErrCode=1, zFormat=0x7fffe96ce958 "apsw_write_unraisable %s: %s", ap=0x7fffff8009c0) at sqlite3/sqlite3.c:32459
#31 0x00007fffe945edfa in sqlite3_log (iErrCode=1, zFormat=0x7fffe96ce958 "apsw_write_unraisable %s: %s") at sqlite3/sqlite3.c:32470
#32 0x00007fffe95d903a in apsw_write_unraisable (hookobject=0x0) at src/util.c:174
#33 0x00007fffe96aaaf1 in apsw_logger (arg=0x7fffe9094ae0, errcode=1, message=0x7fffff800d00 "apsw_write_unraisable TypeError: APSW.testIssue425.<locals>.handler() takes 0 positional arguments but 2 were given") at src/apsw.c:464
#34 0x00007fffe945ece4 in renderLogMsg (iErrCode=1, zFormat=0x7fffe96ce958 "apsw_write_unraisable %s: %s", ap=0x7fffff800e10) at sqlite3/sqlite3.c:32459
#35 0x00007fffe945edfa in sqlite3_log (iErrCode=1, zFormat=0x7fffe96ce958 "apsw_write_unraisable %s: %s") at sqlite3/sqlite3.c:32470
#36 0x00007fffe95d903a in apsw_write_unraisable (hookobject=0x0) at src/util.c:174

These repeat because that is the point of the test until you get into the Python test code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant