SPSS Python Error - python

Getting the following error when trying to run SPSS from an external Python IDE.
import spss
yields the following error
Traceback (most recent call last):
File "C:\Documents and Settings\USER\workspace\SPSS\src\NE ASQ 2010.py", line 6, in <module>
import spss
File "C:\Python26\Lib\site-packages\spss180\spss\spss.py", line 16, in <module>
error = errCode()
File "C:\Python26\Lib\site-packages\spss180\spss\errMsg.py", line 24, in __init__
self.errMsg = errTable['okay'][str(0)]
KeyError: 'okay'
Ran the Python essentials plug-in with no errors. Funny thing is that I dont get an error when I run this in a syntax
BEGIN PROGRAM PYTHON.
import spss
num = spss.GetVariableCount()
print num
END PROGRAM.
Any help will be much appreciated.
Brock

I believe I figured out the issue. I needed to configure Eclipse to see the external python modules that are created when you install the SPSS/Python plugin. I had to set a reference to the modules when configuring the project.
Once I did that, it looks like I am up and running!

Related

Running python file within a shell script : module not found error

I'm beginner to both bash and python.
I'm working in Ubuntu env.
to be short, I've created a shell script 'format_data.sh' that runs python file 'proc_ko.py' within it.
#!/bin/bash
...
python path/to/python/file/proc_ko.py
...
And the python file 'proc_ko.py' imports a module called khaiii
from khaiii import KhaiiiApi
api = KhaiiiApi()
...
But when I try to execute 'format_data.sh', I get this import error from python file.
Traceback (most recent call last):
File "media/sf_projet/pe/pe/PROGRAMME/SCRIPTS/proc_ko.py", line 5, in
from khaiii import KhaiiiApi
ImportError: No module named khaiii
which doesn't occur when I execute python file independently.
Python file 'proc_ko.py' itself doesn't have any error and 'khaiii' is well installed.
so I don't understand why import error occurs only through the shell script.
If u need more details to figure out, I'll be happy to provide. Thanks in advance for help.

Seahub fails to run initial start with ModuleNotFoundError

I'm currently trying to install seafile 7.1.4 on a Raspberry Pi 4 following the official guide (https://download.seafile.com/published/seafile-manual/deploy/using_mysql.md). The setup went smoothly, but when I try to start the seahub (./seahub start) for the first time I get the following error:
Traceback (most recent call last):
File "check_init_admin.py", line 351, in <module>
rpc = RPC()
File "check_init_admin.py", line 284, in __init__
import ccnet
ModuleNotFoundError: No module named 'ccnet'
I've been on google for the past two hours, but can't find a solution to this problem. What am I doing wrong?
I ran into the same issue. There's a bug in the 7.1.4 package. Seafile uses some local site packages. They (apparently) used to be under ${INSTALLPATH}/seafile/lib/python3.6/site-packages, now the are under ${INSTALLPATH}/seafile/lib/python3.7/site-packages
To fix:
open seahub.sh in the editor of your choice.
find the line that says:
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3.6/site-packages:${INSTALLPATH}/seafile/lib64/python3.6/site-packages:${INSTALLPATH}/seahub:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH
change it to read:
export PYTHONPATH=${INSTALLPATH}/seafile/lib/python3.7/site-packages:${INSTALLPATH}/seafile/lib64/python3.7/site-packages:${INSTALLPATH}/seahub:${INSTALLPATH}/seahub/thirdpart:$PYTHONPATH

Receiving a Traceback error while using gingerit in python

I have a startup code to use gingerit on python. Gingerit is by far the most enhanced and the best grammar tool available on python. When I try running the code I have, I started receiving a traceback error.I am currently using 3.7 and the code I used is present on the official gingerit documentation.
text = 'it is there problem'
parser = GingerIt()
parser.parse(text)
I expected to not have any errors on this but there was a traceback error.
Traceback (most recent call last):
File "C:/Users/sid071/Desktop/gingerit.py", line 1, in <module>
from gingerit.gingerit import GingerIt
File "C:/Users/sid071/Desktop\gingerit.py", line 1, in <module>
from gingerit.gingerit import GingerIt
ModuleNotFoundError: No module named 'gingerit.gingerit'; 'gingerit' is not a package
Your script is called gingerit, which is hiding the package you installed. Rename your script to something else.

Python: multiple installations

I was successfully using python in my programs and importing necessary modules including MySQL. However, to get IDLE on my computer I downloaded a new copy of python. I'm really not sure what I did or what happened but when I try to run a program now that uses MySQL I get the following error:
Traceback (most recent call last):
File "MyFile.py", line 11, in <module>
import MySQLdb
File "/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/_mysql.so, 2): Symbol not found: _mysql_affected_rows
Referenced from: /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/_mysql.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/_mysql.so
any ideas on how to fix this?
Actually I fixed the problem by reinstalling MySQLdb following the step found here. I'm not sure how well this will work for additional modules though

RabbitVCS does not work because of python error

Hello
I cannot start running rabbitvcs on openSUSE 11.3 64bit.
I tried to run test.py file which is located in rabbitvcs folder.
It returns the following errors:
jenea#linux-nguv:/usr/lib/python2.6/site-packages/rabbitvcs> python test.py
Traceback (most recent call last):
File "test.py", line 26, in <module>
import lib.helper
File "/usr/lib/python2.6/site-packages/rabbitvcs/lib/__init__.py", line 23, in <module>
from rabbitvcs.lib.log import Log
ImportError: No module named lib.log
PS: I know that is not quite programming question but it seems to me that error occurs because of some paths or settings.
Unfortunately I've no idea where to dig.
Although stupid the answer is the following:
There were two folders where rabbitvcs was intalled. The first was in /usr/lib/rabbitvcs and the second was in /usr/lib64/rabbitvcs. I'm not sure why there was described issue but after I deleted rabbitvcs folder in /usr/lib64 it started to work normally.

Categories