BarraQDA / nvivotools

A range of tools to help you get more out of NVivo(tm)
GNU General Public License v3.0
46 stars 11 forks source link

error running NormaliseNVPX.py #4

Closed itcarroll closed 6 years ago

itcarroll commented 6 years ago

The sqlanyenv.sh script doesn't seem to be producing the expected output, as the regex isn't getting a match in the first line (hence the error).

Python 2.7.15 (default, May  1 2018, 16:44:08) 
Type "copyright", "credits" or "license" for more information.

IPython 5.7.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: %run NormaliseNVPX.py myproj.nvpx
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/Users/icarroll/src/nvivotools/NormaliseNVPX.py in <module>()
     32         envlines = subprocess.check_output(helperpath + 'sqlanyenv.sh').splitlines()
     33         for envline in envlines:
---> 34             env = re.match(r"(?P<name>\w+)='(?P<value>\S+)'", envline).groupdict()
     35             os.environ[env['name']] = env['value']
     36 

The value of envline when the error occurs is Usage: dbeng16 [server options] {database [options]}*.

jschultz commented 6 years ago

That looks quite strange. The value of envline looks like dbeng16 was incorrectly invoked. But envline comes from the output of invoking sqlanyenv.sh which does not invoke dbengxx at all.

Can you provide some more detail of how you invoked NormaliseNVPX.py?

itcarroll commented 6 years ago

I feel I must be missing something about how I am supposed to invoke the script. In the above, I used ipython's %run NormaliseNVPX.py myproj.nvpx, but I get the same error just calling python NormaliseNVPX.py myproj.nvpx. Is the script not intended for direct use?

Yes, it looks to me like sqlanyenv.sh calls dbeng16 at line 32, and this output is returned to python in envlines.

jschultz commented 6 years ago

Ooops looks l like you found a blooper! I just committed some changes. Sorry I don't have a convenient Mac to test then on. Can you see if it works better now?

itcarroll commented 6 years ago

Thanks for investigating. We have moved the ball, slightly...

Now the same regex fails to match with envline equal to 'PIPESTATUS=([0]="1")'.

If I directly call helpers/sqlanyenv.sh from mac Terminal, I get:

PIPESTATUS=([0]="1")
SQLANYWHERE=/Applications/NVivo.app/Contents/SQLAnywhere
_=/Applications/NVivo.app/Contents/SQLAnywhere/bin32/sa_config.sh
jschultz commented 6 years ago

Fixing the regex isn't a problem. But there are some other ugly issues connected with the dynamic libraries of the SQLAnywhere that comes bundled with NVivo that prevent this all from working. I'm working on it.

jschultz commented 6 years ago

OK I had to make some pretty awful hacks, but the NormaliseNVPX.py and DenormaliseNVPX.py scripts now work for me under El Capitan using the NVivo bundled version of SQLAnywhere. See if you have any luck.