Bookworm-project / BookwormDB

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

Installing on shared space with virtualenv #140

Closed apdame closed 5 years ago

apdame commented 5 years ago

So I'm trying to install bookworm on a shared server space using a virtualenv, but I keep hitting a permissions error when I get to the dbbindings.py file ([Errno 13] Permission denied: ‘/var/www/cgi-bin/dbbindings.py’). This issue appears to have been discussed in #115, but I couldn't tell if the workaround had been implemented.

If it hasn't been, is there a good suggestion for how to manually reset the memory tables? That's basically all I need the install for, but in reading the code I wasn't able to parse the exact reset process.

bmschmidt commented 5 years ago

Unfortunately, the fix from #115 is not implemented.

But: to reload the memory tables, you need the command line executable; but that is just a wrapper around a script bundled with the basic install.

I just pushed a commit to a new branch called 'commandline' that basically just allows you to access the command line interface without a fully installed module by replace bookworm reload_memory in commands with python bookwormDB/manager.py reload_memory (and so forth). It needs to be run from the base directory of the project, with the commandline git branch checked out.

Does that seem like it should work?

apdame commented 5 years ago

It should, though I think I might need to pre-define "client." Here's the traceback I get from trying to run the command:

Traceback (most recent call last): File "manager.py", line 570, in run_arguments() File "manager.py", line 567, in run_arguments getattr(my_bookworm,args.action)(args) File "manager.py", line 325, in reload_memory Bookworm = bookwormDB.CreateDatabase.BookwormSQLDatabase(database,variableFile=None) File "/home/queerdig/virtualenv/BookwormDB/2.7/lib/python2.7/site-packages/bookwormDB/CreateDatabase.py", line 153, in init self.dbname = config.get("client","database") File "/opt/alt/python27/lib64/python2.7/ConfigParser.py", line 607, in get raise NoSectionError(section) ConfigParser.NoSectionError: No section: 'client'

bmschmidt commented 5 years ago

OK. Yeah, it's trying to find a mysql configuration file with passwords for the db and not turning one up.

Probably the code should just be trying to log in without credentials--this may be worth changing later. Maybe it would work with a --database argument to the reload command.

If not, try putting a file at either (or both) ~/.my.cnf OR bookworm.cnf in the directory you're working out of which has passwords in it: that should look something like this, although the values will be different.

[client]
database = federalist
password = password123
user = bschmidt
apdame commented 5 years ago

Unfortunately, it seems to not be finding either of the config files in the directory, and using the --database flag also raises the same error, unfortunately. I wonder if this approach is a dead end...

bmschmidt commented 5 years ago

Hmm. This is tough to reproduce, and that time would be probably be better spent on the general issue.

If you just want to get memory tables reloaded on one installation, the barest way to do this is pull the code to update memory tables directly out of the database. When logged into your db in mysql, type:

SELECT memoryCode FROM masterTableTable;

That should yield a bunch of SQL code you can run there, or run SELECT memoryCode FROM masterTableTable INTO OUTFILE '/tmp/code.sql' instead and you'll get a file at /tmp/code.sql that you can run whenever desired.

apdame commented 5 years ago

Yeah, agreed. I may fiddle with it when I get time, but otherwise I'm going to go ahead and close this issue. Thanks for following up on this (seeming) fools' errand!