I'm developing a desktop app which uses the Mayavi package. So, I'm using anaconda with mayavi 4.4.0 and pyqt 4.11.3 (python 2.7). When I try to save the image using the Mayavi interface I get:
KGlobal::locale(): Warning your global KLocale is being recreated with a valid main component instead of a fake component, this usually means you tried to call i18n related functions before your main component was created. You should not do that since it most likely will not work
Object::connect: No such signal org::freedesktop::UPower::DeviceAdded(QDBusObjectPath)
Object::connect: No such signal org::freedesktop::UPower::DeviceRemoved(QDBusObjectPath)
kfilemodule(5709): couldn't create slave: "Unable to create io-slave:
klauncher said: Unknown protocol ''.
"
Traceback (most recent call last):
File "/home/facu/anaconda/lib/python2.7/site-packages/pyface/ui/qt4/action/action_item.py", line 358, in _qt4_on_triggered
action.perform(action_event)
File "/home/facu/anaconda/lib/python2.7/site-packages/pyface/action/action.py", line 100, in perform
self.on_perform()
File "/home/facu/anaconda/lib/python2.7/site-packages/tvtk/pyface/ui/qt4/decorated_scene.py", line 159, in _save_snapshot
if dialog.open() == OK:
File "/home/facu/anaconda/lib/python2.7/site-packages/pyface/i_dialog.py", line 122, in open
self.close()
File "/home/facu/anaconda/lib/python2.7/site-packages/pyface/ui/qt4/file_dialog.py", line 103, in close
self.wildcard_index = self.control.nameFilters().index(
AttributeError: 'QStringList' object has no attribute 'index'
I have fixed others issues editing *.py files, I don't know how to fix this one in particular .
Related
I am using the pyattck module to retrieve information from mitre att&ck.
Versions:
- pyattck==7.0.0
- pyattck-data==2.5.2
Then, I just created a simple main.py file to test the module.
from pyattck import Attck
def main():
attck = Attck()
for technique in attck.enterprise.techniques:
print(technique.name)
if __name__ == '__main__':
main()
When running the main.py script I get the following exception:
Traceback (most recent call last):
File "/<path>/main.py", line 15, in <module>
main()
File "/<path>/main.py", line 8, in main
for technique in attck.enterprise.techniques:
File "/<path_venv>/lib/python3.10/site-packages/pyattck/attck.py", line 253, in enterprise
from .enterprise import EnterpriseAttck
File "/<path_venv>/lib/python3.10/site-packages/pyattck/enterprise.py", line 7, in <module>
class EnterpriseAttck(Base):
File "/<path_venv>/lib/python3.10/site-packages/pyattck/enterprise.py", line 42, in EnterpriseAttck
__attck = MitreAttck(**Base.config.get_data("enterprise_attck_json"))
File "/<path_venv>/lib/python3.10/site-packages/pyattck_data/attack.py", line 55, in __init__
raise te
File "/<path_venv>/lib/python3.10/site-packages/pyattck_data/attack.py", line 53, in __init__
self.__attrs_init__(**kwargs)
File "<attrs generated init pyattck_data.attack.MitreAttck>", line 14, in __attrs_init__
File "/<path_venv>/lib/python3.10/site-packages/pyattck_data/attack.py", line 66, in __attrs_post_init__
raise te
File "/<path_venv>/lib/python3.10/site-packages/pyattck_data/attack.py", line 62, in __attrs_post_init__
data = TYPE_MAP.get(item['type'])(**item)
TypeError: 'NoneType' object is not callable
Anyone knows where is the issue? Maybe I have forgotten to import something? It would be helpful to know if this module actually works in another version. This one is the lasted stable one ATTOW.
UPDATE
There is am issue with this project. Mitre added some new features that are not supported by the module and make it unusable.
There is an issue on github related to this.
They have already fixed this issue in future releases. You just need to update your package pyattck-data form the bugged version 2.5.2 to 2.6.1 (or any newer).
If you are using pip, just run this:
pip install --upgrade pyattck-data
If you are using conda (inside your venv):
conda update pyattck-data
I'm trying to communicate with an OPC DA server and need to write in a tag which is in an array format. We can connect with a simulation server, read tags (int, real, array) and write tags (int, real, str). The problem comes when we need to write in an array tag. The developper of the OpenOPC library (Barry Barnreiter) recommand to use a VARIANT variable because OPC "expect to see a Windows VARIANT structure when writing complex objects such as arrays".
I did install Pywin32 (build 217) as suggested here.
I tried to send a simple integer instead of an array in a VARIANT structure.
Here's the code:
from win32com.client import VARIANT
import pythoncom
import OpenOPC
opc_local = OpenOPC.open_client()
opc_local.connect('Matrikon.OPC.Simulation','localhost')
values = VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_R8, [1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
w = opc_local.write(('Bucket Brigade.ArrayOfReal8', values))
print(w)
Here's the error that we get when the line with opc_local.write gets executed:
AttributeError: 'module' object has no attribute 'VARIANT'
Here's the entire traceback:
runfile('C:/Users/nadmin/Downloads/sanstitre0.py', wdir='C:/Users/nadmin/Downloads')
Traceback (most recent call last):
File "<ipython-input-5-6799f41ab928>", line 1, in <module>
runfile('C:/Users/nadmin/Downloads/sanstitre0.py', wdir='C:/Users/nadmin/Downloads')
File "C:\Users\nadmin\AppData\Local\Continuum\anaconda2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)
File "C:\Users\nadmin\AppData\Local\Continuum\anaconda2\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 95, in execfile
exec(compile(scripttext, filename, 'exec'), glob, loc)
File "C:/Users/nadmin/Downloads/sanstitre0.py", line 14, in <module>
w = opc_local.write(('Bucket Brigade.ArrayOfReal8', values))
File "C:\Users\nadmin\AppData\Local\Continuum\anaconda2\lib\site-packages\Pyro\core.py", line 381, in __call__
return self.__send(self.__name, args, kwargs)
File "C:\Users\nadmin\AppData\Local\Continuum\anaconda2\lib\site-packages\Pyro\core.py", line 456, in _invokePYRO
return self.adapter.remoteInvocation(name, Pyro.constants.RIF_VarargsAndKeywords, vargs, kargs)
File "C:\Users\nadmin\AppData\Local\Continuum\anaconda2\lib\site-packages\Pyro\protocol.py", line 497, in remoteInvocation
return self._remoteInvocation(method, flags, *args)
File "C:\Users\nadmin\AppData\Local\Continuum\anaconda2\lib\site-packages\Pyro\protocol.py", line 572, in _remoteInvocation
answer.raiseEx()
File "C:\Users\nadmin\AppData\Local\Continuum\anaconda2\lib\site-packages\Pyro\errors.py", line 72, in raiseEx
raise self.excObj
And here's the configuration of the computer:
Windows 10
Python 2.7
Pyro 3.16
Pywin32 Build 223
OpenOPC 1.3.1 win32-py27
You have to change your line opc_local = OpenOPC.open_client() for opc_local = OpenOPC.client(). This will make you connect directly to the OPC server, as opposed to using the OpenOPC Gateway Service.
The VARIANT structure is not included inside the Gateway Service exe. Note that the Gateway Service exe is it's own frozen Python distribution. Thus it only includes the Python modules inside it that it needs to run and nothing else. So by avoiding using the Gateway Service you should not have this problem since you'll be executing your code entirely using the Python distribution that you installed yourself on your PC.
According to Python COM server throws 'module' object has no attribute 'VARIANT', the VARIANT class was introduced in Pywin32 build 217.
As you have included in your post that you have Pywin32 Build 223, this should not be a problem. But to be sure, from this list of available downloads: Home / pywin32 / Build 217, I would specifically select pywin32-217.win-amd64-py2.7.exe.
If that doesn't work, I would suggest checking the source of the configuration you listed; Do you only have one version of python installed? Perhaps you have multiple Python IDEs that could get mixed up? These are some common cases that can cause confusion in fixing bugs.
You need to upgrade the python to 3.9 and Pywin32 to Build 302. In addition, you need to install the OpenOPC-Python3x 1.3.1.
I need help in python. I tried to put this code in python shell:
from naoqi import ALProxy
tts = ALProxy("ALTextToSpeech", "127.0.0.1",9559)
tts.say("Hello, world!")
and I get this error:
Traceback (most recent call last):
File "C:/Users/USER/Desktop/say.py", line 2, in <module>
tts = ALProxy("ALTextToSpeech", "127.0.0.1",9559)
File "C:/Users/USER/Desktop\naoqi.py", line 227, in __init__
inaoqi.proxy.__init__(self, args[0], args[1], args[2])
File "C:\Python27\lib\site-packages\inaoqi.py", line 318, in __init__
this = _inaoqi.new_proxy(*args)
RuntimeError: ALBroker::createBroker
Cannot connect to tcp://127.0.0.1:9559
This order happen whether I use virtual robot or real, I use choregraphe 1.14.5 version and python version 2.7.13
The connection is almost never done to 127.0.0.1:9559:
If you're connecting to a real robot, you should replace 127.0.0.1 by it's IP address (or it's domain name, e.g. "nao.local", but may or may not work depending of your local network configuration; when it does work it's more convenient)
If you're connecting to Choregraphe's virtual robot, you should replace 9559 by the virtual robot's port, which you can find in Choregraphe's preferences, at the bottom of the "Virtual Robot" tab, as seen in this image.
I have Asterisk 13.20 set up and running fine on Ubuntu 16.04,calls are going well through a Softphone(Zoiper), I came across a Library in Python "Pycall" which lets you make calls through a Python Script.So I tried testing a snippet from the site Pycall
The code that I used:
from pycall import CallFile, Call, Application
call = Call('SIP/flowroute/18882223333')
action = Application('Playback', 'hello-world')
c = CallFile(call, action)
c.spool()
Just made changes in the extension,wherein I used one from my server
However I am getting the following error:
Traceback (most recent call last):
File "test.py", line 10, in <module>
c.spool()
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 131, in spool
self.writefile()
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 119, in writefile
f.write(self.contents)
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 114, in contents
return '\n'.join(self.buildfile())
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 96, in buildfile
raise ValidationError
pycall.errors.ValidationError
Tried searching online for the solution but coudnt find one,What am I doing wrong?
This question not related to PBX, it is just incorrect use of LIB.
General instruction how to solve ANY issue with availible source code.
You have error
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 96, in buildfile
Go that file and line, check code, add more debug if needed, fix your app.
Run as asterisk user.
sudo su asterisk -s /bin/bash
python
from pycall import CallFile, Call, Application
call = Call('SIP/flowroute/18882223333')
action = Application('Playback', 'hello-world')
c = CallFile(call, action)
c.spool()
At first my running system:
I use Windows 8 Pro and Mayavi 4.3 from the repository together with wxPython 2.9.4.0 at Python 2.7.4 but also had the same issue with mayavi 4.2.1 from the EPD package...
As I try to embedd mayavi into a notebook panel I get some problems with the UI. Even in the demo file from mayavi I got the same strange behavior of external frames generated by mayavi.
So using the settings button a the settings window opens. Also the scene reacts on the parameters I changed using the settings. But after clicking OK or chancel the window does not close. And python gives back several error messages. A simular behavior was there as i used the pipeline by implenting mlab.show_pipeline() command.
This behaivior is could be found on the sample from the enthought web page too.
Here you can see my error message after trying to click OK in the settings frame of the enthougth example:
C:\my_directory\>python wx_embedding.py
C:\Python27\lib\site-packages\enthougth_development_mayavi_git\traitsui\traitsui\wx\toolkit.py:35: wxPyDeprecationWarning: Using deprecated class PySimpleApp.
_app = wx.PySimpleApp()
wx_embedding.py:63: wxPyDeprecationWarning: Using deprecated class PySimpleApp.
app = wx.PySimpleApp()
Traceback (most recent call last): File "C:\Python27\lib\site-packages\enthougth_development_mayavi_git\traitsui\traitsui\wx\ui_live.py", line 360, in _on_ok
self.close( wx.ID_OK )
File "C:\Python27\lib\site-packages\enthougth_development_mayavi_git\traitsui\traitsui\wx\ui_live.py", line 320, in close
ui.finish()
File "C:\Python27\lib\site-packages\enthougth_development_mayavi_git\traitsui\traitsui\ui.py", line 264, in finish
self.reset( destroy = True )
File "C:\Python27\lib\site-packages\enthougth_development_mayavi_git\traitsui\traitsui\ui.py", line 304, in reset
editor.dispose()
File "C:\Python27\lib\site-packages\enthougth_development_mayavi_git\traitsui\traitsui\wx\instance_editor.py", line 208, in dispose
self._ui.dispose()
File "C:\Python27\lib\site-packages\enthougth_development_mayavi_git\traitsui\traitsui\ui.py", line 237, in dispose
self.finish()
File "C:\Python27\lib\site-packages\enthougth_development_mayavi_git\traitsui\traitsui\ui.py", line 264, in finish
self.reset( destroy = True )
File "C:\Python27\lib\site-packages\enthougth_development_mayavi_git\traitsui\traitsui\ui.py", line 318, in reset
toolkit().destroy_children( self.control )
File "C:\Python27\lib\site-packages\enthougth_development_mayavi_git\traitsui\traitsui\wx\toolkit.py", line 474, in destroy_children
control.DestroyChildren()
File "C:\Python27\lib\site-packages\wx-2.9.4-msw\wx\_core.py", line 9203, in DestroyChildren
return _core_.Window_DestroyChildren(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "GetEventHandler() == this" failed at . .\..\src\common\wincmn.cpp(468) in wxWindowBase::~wxWindowBase(): any pushed event handlers must have been removed
Thanks in advance
Mayvi is not compatible with wx 2.9.
More info here: https://support.enthought.com/entries/22601196-wxPython
Please use enpkg to revert to wx 2.8 which ships with EPD.
At least this particular exception can be solved with the changes associated with this PR: https://github.com/enthought/traitsui/pull/108. I don't know about Mayavi and the rest of the stack yet, but that change will at least get traitsui working with wxPython 2.9.