I am trying ro run sphinx search with python but getting error
I try this code
python3
import sphinxapi
client = sphinxapi.SphinxClient()
client.SetServer('127.0.0.1',9312)
client.Query("english","language_index")
get an error
client.Query("english","language_index")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/sphinxapi/__init__.py", line 579, in Query
assert (len(self._reqs) == 0)
AssertionError
Related
I have installed the symbolic package. There are some python related errors in the command window of Octave when I try to use symbolic.Below is the output:
> pkg load symbolic
>> syms a
Symbolic pkg v2.9.0: Traceback (most recent call last):
File "<stdin>", line 28, in <module>
AttributeError: '_PrintFunction' object has no attribute '__globals__'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 12, in octoutput_drv
File "<stdin>", line 54, in octoutput
File "<stdin>", line 55, in octoutput
AttributeError: module 'sympy' has no attribute 'compatibility'
Closing the Python communications link.
error: Python exception: AttributeError: '_PrintFunction' object has no attribute '__globals__'
occurred in python_header import block.
Try "sympref reset" and repeat your command?
(consider filing an issue at https://github.com/cbm755/octsympy/issues)
error: called from
pycall_sympy__ at line 191 column 5
valid_sym_assumptions at line 38 column 10
assumptions at line 82 column 7
syms at line 97 column 13
>> Opening in existing browser session.
Any idea how i can troubleshoot this?
Thanks.
The error is a known bug (https://github.com/cbm755/octsympy/issues/1035)
You need to use an older version of sympy sunch as version 1.5.1
I wanted to test my PyVISA installation and got a certain failure:
>>> import visa
>>> rm = visa.ResourceManager()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python35\lib\site-packages\pyvisa\highlevel.py", line 1
488, in __new__
visa_library = open_visa_library(visa_library)
File "C:\Program Files\Python35\lib\site-packages\pyvisa\highlevel.py", line 1
460, in open_visa_library
return cls(argument)
File "C:\Program Files\Python35\lib\site-packages\pyvisa\highlevel.py", line 9
6, in __new__
raise OSError('Could not open VISA library:\n' + '\n'.join(errs))
OSError: Could not open VISA library:
>>>
What could be my problem ?
I have tried to update the VISA path:
>>> rm = ResourceManager('C:\Program Files\Python35\Lib\site-packages')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'ResourceManager' is not defined
>>> visalib = VisaLibrary('C:\Program Files\Python35\Lib\site-packages')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'VisaLibrary' is not defined
>>> rm = ResourceManager('C:/Program Files/Python35/Lib/site-packages')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'ResourceManager' is not defined
>>> import visa
>>> rm = ResourceManager('C:\Program Files\Python35\Lib\site-packages')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'ResourceManager' is not defined
>>>
Without any success
PyVISA is only Python wrapper for DLL which standard location is somewhere in Windows. For example at my PC is C:\Windows\System32\visa64.dll.
At my code i use rm = visa.ResourceManager(C:\\Windows\\System32\\visa64.dll)
Of course first time you have to get VISA library which is part of huge NI-VISA installation package which you can found here:
NI-VISA Download Installer
When I write the following line of code
import urllib
I get this error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/urllib.py", line 26, in <module>
import socket
File "socket.py", line 2, in <module>
s = socket.socket()
TypeError: 'module' object is not callable
After going through various questions on SO I tried these:
from urllib import urlopen
(Same error as above)
>>> urllib
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'urllib' is not defined
>>> urllib.urlopen()
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'urllib' is not defined
Please help. I get a similar error when I try to import urllib2, urllib3, requests.
You named your file socket.py, hiding the standard library socket module. Name it something else.
I am trying to generate the help text at runtime and i am not able to use the pydoc command in Windows. When i type
>>> pydoc(atexit)
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'pydoc' is not defined
I have already set up the environment variables for pydoc.py file. C:\Python33\Lib\pydoc.py.
This also not works like it works for >>help('atexit')
>>> pydoc('atexit')
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'pydoc' is not defined
Whats the possible reason for it.
Updates:
>>> import pydoc
>>> pydoc(sys)
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: 'module' object is not callable
>>> pydoc('sys')
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: 'module' object is not callable
Like any library in Python, you need to import it before you can use it.
Edit What exactly are you trying to achieve? Modules are indeed not callable. pydoc.help is the function you want, although I don't really know why you need it, since as you note the standalone help function does the same thing already.
I'm trying to use PyKDE, PyKDE.kdecore.KStandardDirs to be precise. This method is called with two strings according to the documentation and according to the PyQt4 documentation, I can use standard Python strs instead of QString.
This doesn't work:
>> KStandardDirs.locate()("socket", "foo")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: KStandardDirs.locate(): not enough arguments
>>> KStandardDirs.locate("socket", "foo")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: KStandardDirs.locate(): argument 1 has unexpected type 'str'
I can't use QString either because it doesn't seem to exist:
>>> from PyQt4.QtCore import QString
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name QString
>>> from PyQt4.QtCore import *
>>> QString
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'QString' is not defined
What am I doing wrong?
I suspect that PyKDE is not yet Python 3 ready, at least as far as that error message is concerned; try passing in a bytestring instead:
KStandardDirs.locate(b"socket", "foo")