Bookworm-project / BookwormDB

Tools for text tokenization and encoding
MIT License
84 stars 12 forks source link

Bookworm Build All Raise SQL syntax error #120

Closed xiaoyinghu closed 7 years ago

xiaoyinghu commented 7 years ago

I'm in "Running the Script" section. Passed "Bookworm init", got errors when run "bookworm build all". I'm building bookworm on Ubuntu 16.04 VM. One error I noticed is sql syntax error: _mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-bin' at line 1")

Has Anyone seen this one before?

Traceback: bookworm -l WARNING -d cgi-bin prep database_wordcounts 27/2016 20:54:56:ERROR:Query failed: DROP TABLE IF EXISTS words

Traceback (most recent call last): File "/usr/local/bin/bookworm", line 9, in load_entry_point('bookwormDB==0.4.0', 'console_scripts', 'bookworm')() File "/usr/local/lib/python2.7/dist-packages/bookwormDB-0.4.0-py2.7.egg/bookwormDB/manager.py", line 567, in run_arguments getattr(my_bookworm,args.action)(args) File "/usr/local/lib/python2.7/dist-packages/bookwormDB-0.4.0-py2.7.egg/bookwormDB/manager.py", line 238, in prep getattr(self,args.goal)() File "/usr/local/lib/python2.7/dist-packages/bookwormDB-0.4.0-py2.7.egg/bookwormDB/manager.py", line 379, in database_wordcounts Bookworm.load_word_list() File "/usr/local/lib/python2.7/dist-packages/bookwormDB-0.4.0-py2.7.egg/bookwormDB/CreateDatabase.py", line 224, in load_word_list db.query("""DROP TABLE IF EXISTS words""") File "/usr/local/lib/python2.7/dist-packages/bookwormDB-0.4.0-py2.7.egg/bookwormDB/CreateDatabase.py", line 109, in query self.connect() File "/usr/local/lib/python2.7/dist-packages/bookwormDB-0.4.0-py2.7.egg/bookwormDB/CreateDatabase.py", line 82, in connect cursor.execute("CREATE DATABASE IF NOT EXISTS %s" % self.dbname) File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 205, in execute self.errorhandler(self, exc, value) File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue _mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-bin' at line 1") /usr/local/lib/python2.7/dist-packages/bookwormDB-0.4.0-py2.7.egg/bookwormDB/etc/bookworm_Makefile:154: recipe for target '.bookworm/targets/database_wordcounts' failed make: *\ [.bookworm/targets/database_wordcounts] Error 1

bmschmidt commented 7 years ago

One guess based on the errors: What is the name that you assigned to the Bookworm in your bookworm.cnf file? Is it something like text-bin? If so, you could try changing to text_bin (that is, no characters outside the range [A-Za-z_0-9]).

xiaoyinghu commented 7 years ago

Got different error after change cgi-bin to cgi_bin. I have three lines in below bookworm.cnf. Since bookworm.conf is automatically generated, I'm wondering if there's a way to specify which user to use. I can change the user to root, but don't have the password. Attaching sql errors below. Any idea what can go wrong with bookworm.cnf, or it's database problem. [client] database = cgi_bin password = xxxxxxxxxxxxxxxxxx user = bookworm_client

28/2016 10:58:17:ERROR:Query failed: SELECT count(*) FROM fastcat

28/2016 10:58:18:ERROR:Query failed: SELECT count() FROM wordsheap 28/2016 10:58:18:ERROR:Query failed: SELECT count() FROM enactedheap

28/2016 10:58:18:ERROR:Query failed: SELECT count(*) FROM enactedLookup

28/2016 10:58:18:ERROR:Query failed: SELECT count(*) FROM sponsor_stateheap

28/2016 10:58:18:ERROR:Query failed: SELECT count(*) FROM sponsor_stateLookup

bmschmidt commented 7 years ago

Although it writes these errors to screen, it's likely that the Bookworm has actually built successfully. (These errors should be muted, but are not). You can start a test webserver by typing 'bookworm serve'.

xiaoyinghu commented 7 years ago

ran bookworm serve, got some positive messages like A local bookworm server is now running, but still error messages, as results, http://'remotehost':8005/D3 not coming up. More hints on what's wrong in SocketServer.py?

Traceback (most recent call last): File "/usr/local/bin/bookworm", line 9, in load_entry_point('bookwormDB==0.4.0', 'console_scripts', 'bookworm')() File "/usr/local/lib/python2.7/dist-packages/bookwormDB-0.4.0-py2.7.egg/bookwormDB/manager.py", line 567, in run_arguments getattr(my_bookworm,args.action)(args) File "/usr/local/lib/python2.7/dist-packages/bookwormDB-0.4.0-py2.7.egg/bookwormDB/manager.py", line 216, in serve httpd.serve_forever() File "/usr/lib/python2.7/SocketServer.py", line 231, in serve_forever poll_interval) File "/usr/lib/python2.7/SocketServer.py", line 150, in _eintr_retry return func(*args)

xiaoyinghu commented 7 years ago

My remote instance of cgi_bin was able to run after enabled CGI @ http://'remotehost'/cgi_bin. Since my web directory is at /var/www/html/cgi_bin, my bookworm.cnf has database name as cgi_bin.

However, there's database error prevent line chart got retrieved after launch http://'remotehost'/cgi_bin.

Ben, I'm wondering if you have came across this one? The trace mentioned "Unknown database newsarchive".

[Sun Oct 30 07:57:06.652262 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: OperationalError: (1049, "Unknown database 'newsarchive'"): /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652421 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: ERROR:root:Database error: /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652431 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: Traceback (most recent call last):: /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652446 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: File "/usr/lib/cgi-bin/bookwormDB/general_API.py", line 358, in execute: /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652457 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: return self.multi_execute(version=version): /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652473 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: File "/usr/lib/cgi-bin/bookwormDB/general_API.py", line 402, in multi_execute: /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652479 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: version=version): /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652495 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: File "/usr/lib/cgi-bin/bookwormDB/general_API.py", line 415, in return_json: /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652501 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: data = self.data(): /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652516 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: File "/usr/lib/cgi-bin/bookwormDB/general_API.py", line 225, in data: /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652527 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: self.pandas_frame = self.get_data_from_source(): /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652544 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: File "/usr/lib/cgi-bin/bookwormDB/general_API.py", line 285, in get_data_from_source: /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652562 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: column_search = re.search("Unknown column '(.+)' in 'field list'",str(error)).groups(): /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/ [Sun Oct 30 07:57:06.652580 2016] [cgi:error] [pid 34798] [client 139.52.147.166:54987] AH01215: AttributeError: 'NoneType' object has no attribute 'groups': /usr/lib/cgi-bin/dbbindings.py, referer: http://129.106.31.186/cgi_bin/

Thanks. Xiaoying

xiaoyinghu commented 7 years ago

This error is fixed after modify json fille.