having issues with pykd (pykd.DbgException: Call IDebugClient::GetOutputCallbacks failed HRESULT 0x80010107) - python

I'm working with pykd and am able to connect it with my debugger (windbg) but for some reason I'm unable to process any command with pykd.dbgCommand not sure what the issue is as I've tried multiple methods to try and resolve the issue:
Reinstall pydk + python
tried on python2.7, python3.5, python3.8
tried a different system + different debug session
when I tried to run the command on the windbg session it was able to produce the results but somehow it's now able to do that from python console.
pykd.dbgCommand("!analyze -v")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pykd.DbgException: Call IDebugClient::GetOutputCallbacks failed
HRESULT 0x80010107
any help would be appreciated.
thanks to everyone answering in advance.

I tried to run dbgCommand('!analyze -v') with three different dump from python REPL:
usermode native dump: OK
kernel mode dump: OK
managed app dump:
0:000> !py
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> dbgCommand('analyze -v')
Traceback (most recent call last):
File "<console>", line 1, in <module>
pykd.DbgException: Call IDebugControl::ExecuteWide failed
HRESULT 0x80040205
Then I run this script:
import pykd
a = pykd.dbgCommand('!analyze -v')
print(a)
this script works OK with all of these dump.
I believe there is a bug. I've opened an issue:
https://githomelab.ru/pykd/pykd-ext/-/issues/15
Can you provide a dump which reproduce the bug to the pykd issues tracker.

Related

How do i upload tinkergraph into python/gremlin?

I am trying to use gremlin in python. I imported the following:
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from gremlin_python.structure.graph import Graph
from gremlin_python import statics
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.process.traversal import *
import asyncio
statics.load_statics(globals())
When i run this:
graph = TinkerGraph.open()
graph.io(graphml()).readGraph('air-routes.graphml')
i get the following error:
NameError: name 'TinkerGraph' is not defined
How do i resolve this?
There is no TinkerGraph in Python. In gremlin-python you only get a reference to a graph remotely on a server and that might be a TinkerGraph or something else. If you want to load data that way, you must issue that command as a script through a Client instance:
client = Client('ws://localhost:45940/gremlin', 'g')
client.submit("graph.io(graphml()).readGraph('air-routes.graphml');[]").all().result()
where "graph" in that script is a Graph instance that already exists on the server (and is likely empty). If you're using Gremlin Server, you might consider doing that loading separately as part of Gremlin Server startup as well and then just using gremlin-python to query that data. That would probably be best in this example as the data would just be present when the server is started.
Note that in 3.4.0, we introduce the io() step which will be part of gremlin-python directly at which point you will be able to directly do:
g.io('air-routes.xml').read()
in native python and it will just work (again, the Graph instance must be defined remotely) though the file must be readable by the server.
Here's my working example in the Python shell for submitting a script, first with the tornado error and then without:
$ env/bin/python
Python 3.4.3 (default, Nov 28 2017, 16:41:13)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gremlin_python.driver.client import Client
>>> client = Client('ws://localhost:8182/gremlin', 'g')
>>> client.submit("g.V()").all().result()
Traceback (most recent call last):
File "/home/smallette/git/apache/incubator-tinkerpop/gremlin-python/target/python3/gremlin_python/driver/client.py", line 51, in __init__
from gremlin_python.driver.tornado.transport import (
File "/home/smallette/git/apache/incubator-tinkerpop/gremlin-python/target/python3/gremlin_python/driver/tornado/transport.py", line 19, in <module>
from tornado import ioloop, websocket
ImportError: No module named 'tornado'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/smallette/git/apache/incubator-tinkerpop/gremlin-python/target/python3/gremlin_python/driver/driver_remote_connection.py", line 45, in __init__
password=password)
File "/home/smallette/git/apache/incubator-tinkerpop/gremlin-python/target/python3/gremlin_python/driver/client.py", line 54, in __init__
raise Exception("Please install Tornado or pass"
Exception: Please install Tornado or passcustom transport factory
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit()
$ env/bin/pip install tornado
Collecting tornado
Collecting backports-abc>=0.4 (from tornado)
Using cached https://files.pythonhosted.org/packages/7d/56/6f3ac1b816d0cd8994e83d0c4e55bc64567532f7dc543378bd87f81cebc7/backports_abc-0.5-py2.py3-none-any.whl
Installing collected packages: backports-abc, tornado
Successfully installed backports-abc-0.5 tornado-5.1.1
smallette#ubuntu:~/git/apache/incubator-tinkerpop/gremlin-python/target/python3$ env/bin/python
Python 3.4.3 (default, Nov 28 2017, 16:41:13)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gremlin_python import statics
>>> client = Client('ws://localhost:8182/gremlin', 'g')
>>> client.submit("g.V()").all().result()
[v[0]]

Python 2.7 64 bit search path

I am trying to load sqlite 64 bit while running Python 2.7 64 bit. I can do this interactively, but, not from a script.
Interactive:
$ /c/Python27-64/python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>>
From this script, one single line, the same as was done from the python shell:
import sqlite3
Run from command line:
$ /c/Python27-64/python test.py
Traceback (most recent call last):
File "test.py", line 1, in <module>
import sqlite3
File "c:\Python27-64\lib\sqlite3\__init__.py", line 24, in <module>
from dbapi2 import *
File "c:\Python27-64\lib\sqlite3\dbapi2.py", line 28, in <module>
from _sqlite3 import *
ImportError: DLL load failed: %1 is not a valid Win32 application.
The script is obviously finding a 32 bit dll. But why? What is the difference between interactive and from the single line script? How is the DLL search being modified?
In case anyone runs into this, the problem was the file _sqlite3.pyd in the directory I was running the script. Can someone explain why Python creates it's own version of the Windows dll? Is this simply wrapped so that Python can make calls into it? Perhaps a ctypes wrapper?

When I try and run pyspark.cmd I get the error message "find: 'version': No such file or directory"

I'm trying to get started with Apache Spark. I'd like to use it via python. However, when I run pyspark from the command line I get the following error message:
C:\Programs\Apache\Spark\spark-1.2.0-bin-hadoop2.4\bin>pyspark.cmd
Running python with PYTHONPATH=C:\Programs\Apache\Spark\spark-1.2.0-bin-hadoop2.
4\bin\..\python\lib\py4j-0.8.2.1-src.zip;C:\Programs\Apache\Spark\spark-1.2.0-bi
n-hadoop2.4\bin\..\python;
Python 2.7.8 |Anaconda 2.1.0 (32-bit)| (default, Jul 2 2014, 15:13:35) [MSC v.1
500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
find: 'version': No such file or directory
else was unexpected at this time.
Traceback (most recent call last):
File "C:\Programs\Apache\Spark\spark-1.2.0-bin-hadoop2.4\bin\..\python\pyspark
\shell.py", line 45, in <module>
sc = SparkContext(appName="PySparkShell", pyFiles=add_files)
File "C:\Programs\Apache\Spark\spark-1.2.0-bin-hadoop2.4\python\pyspark\contex
t.py", line 102, in __init__
SparkContext._ensure_initialized(self, gateway=gateway)
File "C:\Programs\Apache\Spark\spark-1.2.0-bin-hadoop2.4\python\pyspark\contex
t.py", line 211, in _ensure_initialized
SparkContext._gateway = gateway or launch_gateway()
File "C:\Programs\Apache\Spark\spark-1.2.0-bin-hadoop2.4\python\pyspark\java_g
ateway.py", line 73, in launch_gateway
raise Exception(error_msg)
Exception: Launching GatewayServer failed with exit code 255!
Warning: Expected GatewayServer to output a port, but found no output.
When I try and run the scala interface by running spark-shell I get the message:
find: 'version': No such file or directory
else was unexpected at this time.
I cant find any info on this error online, other than
which turned out to be a dead end.
https://issues.apache.org/jira/browse/SPARK-3808
Please help!
I had the same problem in spark 1.2.0 but not in spark 1.0.2.
The reason was in my case that I had cygwin in the DOS classpath.
Spark uses the find command in the file 'spark-class2.cmd', which used then the cygwin find command instead of the DOS find command, which works somewhat different.
I removed cygwin from the DOS PATH, which solved the problem.
Regards, Felix

Python error importing bottle.py on Windows 7

I've installed Python 3.3 on a Windows 7 machine. I wanted to try to the Bottle micro web
framework. I downloaded the bottle.py (latest version from their site) and put it in my app
folder.
When I do the first line in the tutorial, "from bottle import route, run, template"
I got this error message:
*C:\Dev>python
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:57:17) [MSC v.1600 64 bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from bottle import route,run,template
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".\bottle.py", line 564
raise exc_info[0], exc_info[1], exc_info[2]
^
SyntaxError: invalid syntax
>>>*
Any suggestions how I can fix this problem and continue?
Thanks
You need to follow the bottle installation instructions.
The latest version is published to PyPI, you have an old version of the code there still, one that is not compatible with Python 3.
The format
raise Exception, args
is not there anymore in Python 3+.
That is why the statement is throwing syntax error:
raise exc_info[0], exc_info[1], exc_info[2]
That was a bug introduced 5 days ago and fixed today. Just download bottle.py again. Or use a stable release as suggested by Martijn Pieters

os.tmpfile() doesn't work under windows?

I'm trying to use generateDS under windows, which uses os.tmpfile. Unfortunately, os.tmpfile doesn't work for me:
(oneclickcos) C:\Users\Marcin\Documents\oneclickcos\xsd>python
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.tmpfile()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 13] Permission denied
>>>
I've got all my temp directories set with full control for everyone, so that shouldn't be the problem.
What could be causing this?
Run the script as administrator (right click on the script and select 'run as administrator'), the script lacks the permissions to execute os.tmpfile().
Edit:
As I see you're using the interpreter, simply run the interpreter as administrator. If you're accessing it though a terminal, running the terminal as administrator should be sufficient.
As Griffin pointed out the problem is that the os.tmpfile() tries to create a file in the root directory. If you don't like to run the script as administrator you can use os.tmpnam() and handle the file yourself.
Warning: Use of tmpnam() is vulnerable to symlink attacks

Categories