When using Joern, I accessed the Neo4j database via python-joern with the following code.
from joern.all import JoernSteps
j = JoernSteps()
j.setGraphDbURL('http://localhost:7474/db/data/')
j.connectToDatabase()
res = j.runGremlinQuery('getFunctionsByName("main")')
for r in res: print r
Error like this
Traceback (most recent call last):
File "test.py", line 11, in <module>
res = j.runGremlinQuery('getFunctionsByName("main")')
File "/home/binbin/Downloads/python-joern-0.3.1/joern/all.py", line 44, in runGremlinQuery
return self.gremlin.execute(finalQuery)
File "/usr/local/lib/python2.7/dist-packages/py2neo-2.0-py2.7-linux-x86_64.egg/py2neo/ext/gremlin/__init__.py", line 36, in execute
response = self.resources["execute_script"].post({"script": script})
File "/usr/local/lib/python2.7/dist-packages/py2neo-2.0-py2.7-linux-x86_64.egg/py2neo/core.py", line 288, in post
raise_from(self.error_class(message, **content), error)
File "/usr/local/lib/python2.7/dist-packages/py2neo-2.0-py2.7-linux-x86_64.egg/py2neo/util.py", line 215, in raise_from
raise exception
py2neo.error.NoClassDefFoundError: javax/transaction/SystemException
How to fix it?
I had searched a lot for my question. Finally I found the solution here: https://github.com/fabsx00/python-joern/issues/14. Anyone who has got the same problem can see it.
Related
when I write the command line in terminal
bench new-site site1.local
This Error Will shown
> Traceback (most recent call last):
File "/home/ubuntu/.local/bin/bench", line 8, in <module>
sys.exit(cli())
File "/home/ubuntu/bench/bench/cli.py", line 71, in cli
cmd_from_sys = get_cmd_from_sysargv()
File "/home/ubuntu/bench/bench/utils/__init__.py", line 554, in get_cmd_from_sysargv
if sys_argv.index(arg) == 0 and arg in Bench(".").apps:
File "/home/ubuntu/bench/bench/bench.py", line 67, in __init__
self.apps = BenchApps(self)
File "/home/ubuntu/bench/bench/bench.py", line 174, in __init__
self.initialize_apps()
File "/home/ubuntu/bench/bench/bench.py", line 281, in initialize_apps
self.apps.remove("frappe")
ValueError: list.remove(x): x not in list
Note I use EC2 On AWS Ubunto server
Can Any One Help With This Problem Please.
I tried to install many lib but no help with this problem
I have installed pyreadr and would like to use it to read .RData. I have followed the direction given from the previous comment on here Loading RData but that did not work for me.
When I try the following line (with the path pointing to the right file):
result = pyreadr.read_r('/path/to/file.RData')
I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/apps/bioapps/python/Python-3.6.1/lib/python3.6/site-packages/pyreadr/pyreadr.py",
line 80, in list_objects
parser.parse(path)
File "pyreadr/librdata.pyx", line 117, in pyreadr.librdata.Parser.parse
File "pyreadr/librdata.pyx", line 142, in pyreadr.librdata.Parser.parse
pyreadr.custom_errors.LibrdataError: Unable to read from file
Please let me know if you have any suggestions.
Thanks!
I am using suds-client for soap wsdl services. When i try to setup the suds client for soap service, I get the Type not found error. I search everywhere. There are many unanswered questions with the same error. I am adding the links as Question1, Question2, Question3
Here is my code
from suds.client import Client
wsdlfile = 'http://track.tcs.com.pk/trackingaccount/track.asmx?WSDL'
track_client = Client(TCS_TRACK_URI)
On the last line, I got this error
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/adil/Code/mezino/RoyalTag/royal_tag_services/sms_service/tcs_api.py", line 24, in <module>
track_client = Client(TCS_TRACK_URI)
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/reader.py", line 152, in open
d = self.fn(url, self.options)
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/wsdl.py", line 159, in __init__
self.build_schema()
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/xsd/schema.py", line 95, in load
child.dereference()
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/xsd/schema.py", line 323, in dereference
midx, deps = x.dependencies()
File "/home/adil/Code/mezino/RoyalTag/royalenv/local/lib/python2.7/site-packages/suds/xsd/sxbasic.py", line 422, in dependencies
raise TypeNotFound(self.ref)
TypeNotFound: Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'
Please help me find a solution ?
I have been searching for the answer and finally I found a solution that solved my problem.
We Just need to add the missing schema to the imports of suds. Below is the code
from suds.xsd.doctor import Import, ImportDoctor
imp=Import('http://www.w3.org/2001/XMLSchema',location='http://www.w3.org/2001/XMLSchema.xsd')
imp.filter.add('http://tempuri.org/')
track_client = Client(TCS_TRACK_URI, doctor=ImportDoctor(imp))
Im trying to connect to a SOAP/WSDL server through my Python script:
# based on the tutorial:
# http://www.diveintopython.net/soap_web_services/
import pprint
from SOAPpy import WSDL
WSDLFILE = "https://api.comscore.com/KeyMeasures.asmx?WSDL"
proxy = WSDL.Proxy(WSDLFILE)
proxy.soapserver.config.dumpSOAPIn=1
proxy.soapserver.config.dumpSOAPOut=1
When I run this script I get the following error:
Traceback (most recent call last):
File "/Users/XX/PycharmProjects/Test_Proj/Comscore_connector.py", line 9, in <module>
proxy = WSDL.Proxy(WSDLFILE)
File "/Users/XXpython_projects/lib/python2.7/site-packages/SOAPpy/WSDL.py", line 85, in __init__
self.wsdl = reader.loadFromString(str(wsdlsource))
File "/Users/XX/python_projects/lib/python2.7/site-packages/wstools/WSDLTools.py", line 47, in loadFromString
return self.loadFromStream(StringIO(data))
File "/Users/XX/python_projects/lib/python2.7/site-packages/wstools/WSDLTools.py", line 28, in loadFromStream
document = DOM.loadDocument(stream)
File "/Users/XX/python_projects/lib/python2.7/site-packages/wstools/Utility.py", line 645, in loadDocument
return xml.dom.minidom.parse(data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/minidom.py", line 1918, in parse
return expatbuilder.parse(file)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py", line 928, in parse
result = builder.parseFile(file)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py", line 207, in parseFile
parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 6
Process finished with exit code 1
Ive looked a the following links for SOAP examples:
http://users.skynet.be/pascalbotte/rcx-ws-doc/python.htm
http://code.activestate.com/recipes/502259-calling-a-web-service-using-soappy/
However, there isn't much I could find elsewhere....
Would really appreciate any advice to point me in the right direction.
I am trying to delete a spreadsheet in Google Docs with this function:
def f_DeleteResource(xls_name):
"""Delete a resource"""
client=Auth()
for e1 in client.GetResources().entry:
e2 = client.GetResource(e1)
if xls_name==e2.title.text:
client.DeleteResource(e2.resource_id.text,True)
And I obtain different errors when I change the first parameter of client.DeleteResource(p1,p2):
client.DeleteResource(e2.resource_id.text,True):
Traceback (most recent call last):
File "C:\xmp\D6GDocsDeleteUpload.py", line 164, in <module> main()
File "C:\xmp\D6GDocsDeleteUpload.py", line 157, in main f_DeleteResource(sys.argv[2])
File "C:\xmp\D6GDocsDeleteUpload.py", line 144, in f_DeleteResource client.DeleteResource(e2.resource_id.text,True)
File "C:\Python27\lib\site-packages\gdata\docs\client.py", line 540, in delete_resource uri = entry.GetEditLink().href
AttributeError: 'str' object has no attribute 'GetEditLink'
client.DeleteResource(e2,True):
Traceback (most recent call last):
File "C:\xmp\D6GDocsDeleteUpload.py", line 164, in <module> main()
File "C:\xmp\D6GDocsDeleteUpload.py", line 157, in main f_DeleteResource(sys.argv[2])
File "C:\xmp\D6GDocsDeleteUpload.py", line 144, in f_DeleteResource client.DeleteResource(e2,True)
File "C:\Python27\lib\site-packages\gdata\docs\client.py", line 543, in delete_resource return super(DocsClient, self).delete(uri, **kwargs)
File "C:\Python27\lib\site-packages\gdata\client.py", line 748, in delete **kwargs)
File "C:\Python27\lib\site-packages\gdata\docs\client.py", line 66, in request return super(DocsClient, self).request(method=method, uri=uri, **kwargs)
File "C:\Python27\lib\site-packages\gdata\client.py", line 319, in request RequestError)
gdata.client.RequestError: Server responded with: 403, <errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>matchHeaderRequired</code><location type='header'>If-Match|If-None-Match</location><internalReason>If-Match or If-None-Match header or entry etag attribute required</internalReason></error></errors>
Anyone can help me?
It seems to be a bug in Google API Python library. I checked gdata-2.0.16 and noticed that DeleteResource() function uses only URL of the resource (gdata/docs/client.py lines 540-543), but later checks for hasattr(entry_or_uri, 'etag') (gdata/client.py lines 737-741) and of course string value (uri) doesn't have etag attribute.
You may work around it using force keyword argument:
import gdata.docs.data
import gdata.docs.client
client = gdata.docs.client.DocsClient()
client.ClientLogin('xxxxxx#gmail.com', 'xxxxxx', 'XxX')
for doc in client.GetAllResources():
if doc.title.text == 'qpqpqpqpqpqp':
client.DeleteResource(doc, force=True)
break
If you want you may report an error to library maintainers (if it isn't already reported).
This issue has been fixed in this revision:
http://code.google.com/p/gdata-python-client/source/detail?r=f98fff494fb89fca12deede00c3567dd589e5f97
If you sync you client to the repository, you should be able to delete a resource without having to specify 'force=True'.