pidcat
pidcat copied to clipboard
in windows,how to use? search anywhere,nothing.
It's just a python script. You can run with python pidcat.py
.
I face a similar issue.Running python pidcat.py
provides me the same output as adb logcat
(This is the expected behaviour ).
However
python pidcat.py apptag
yields no output
Easiest is to install cygwin and use its terminal.
I solved this issue by using a different version of python. However the windows terminal renders this without colored text and line wrapping.Is there anyway to overcome that?
Same here, how to setup colored text output for Windows without cygwin?
Windows 10 solves this with Bash.And i think even the default terminal application supports colors now .You could also try other terminal apps for windows. But the default one will not support colours
@droidekas Which version of python did you try? I tried with 2.7 and 3.2, it doesn't work.
@castrojr913 ,I used 3.4.4
i run python pidcat.py in windows but it doesn't work
For some reason, if I write in cmd python pidcat.py
- it fails with :
Traceback (most recent call last):
File "C:\Android\SDK\platform-tools\pidcat.py", line 199, in <module>
adb = subprocess.Popen(adb_command, stdin=PIPE, stdout=PIPE, stderr=PIPE)
File "E:\Packages\Python35\lib\subprocess.py", line 950, in __init__
restore_signals, start_new_session)
File "E:\Packages\Python35\lib\subprocess.py", line 1220, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] **here says "can't find file"**
But if I write .bat
file with same content and run it as it is (without cmd
), than it runs okay (but no colorization/wrapping).
As @jsbeckr suggested, only cygwin
helped
Using cmder http://cmder.net/
i tried cmder/cygwin/powershell however, python pidcat.py apptag no output my python version is 3.5
I dug into the script and found two changes that made it work for me. I'm using python 3.6
To get the script to recognize package change this line:
catchall_package = filter(lambda package: package.find(":") == -1, package)
to
catchall_package = list(filter(lambda package: package.find(":") == -1, package))
because of this: https://stackoverflow.com/questions/21715268/list-returned-by-map-function-disappears-after-one-use
To get the formatting to look right in my command prompt I took out the encode command on the last line:
print(linebuf)
i run python pidcat.py com.oprah.bees.android in windows but it doesn't work
I'm using in cygwin, but I needed to revert this change: https://github.com/JakeWharton/pidcat/commit/6b6034ab67de794e6e16439488dcc03ebb2e02ef
From:
print(linebuf.encode('utf-8'))
To:
print(linebuf)
It'll print colorized string instead of printing the bytes:
string:
bytes:
P.S.: I'm using python 3.6.4
Before start trying with "Bash On Ubuntu On Windows", please check if it was added support to USB devices: https://askubuntu.com/a/826642
I added this to the script to enable native VT100 support on Windows 10:
from ctypes import *
def enableVT100():
STD_OUTPUT_HANDLE = -11
ENABLE_VIRTUAL_TERMINAL_PROCESSING = 4
stdout = windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
if stdout == -1:
raise WinError()
mode = c_uint()
if windll.kernel32.GetConsoleMode(stdout, byref(mode)) == 0:
raise WinError()
mode.value = mode.value | ENABLE_VIRTUAL_TERMINAL_PROCESSING
if windll.kernel32.SetConsoleMode(stdout, mode) == 0:
raise WinError()
enableVT100()
Tested on Window 10 v1709, worked like a charm. No Bash or Cygwin required.
I forked this repo and included the above VT100 enabling code: https://github.com/Torvin/pidcat-win10
@JakeWharton will a pull request with my changes be accepted?
@Torvin your fork works great but I am not able to use the package filtering. if I run python.exe .\pidcat.py in both Powershell and git bash I can see all the logs with colors and format but all the logcat output.
If i want to see my package only i cannot see any log at all for example: python.exe .\pidcat.py com.my.package
Do you know if something has changed with latest android 10 release? Thanks in advance!
I just wanted to say that the above-mentioned change made the script (downloaded just now) work for me on Windows 10, Python 3.7.6 in a plain (cmd.exe
) command prompt. Previously, pidcat <app-package>
produced no output.
I dug into the script and found two changes that made it work for me. I'm using python 3.6
To get the script to recognize package change this line:
catchall_package = filter(lambda package: package.find(":") == -1, package)
to
catchall_package = list(filter(lambda package: package.find(":") == -1, package))
because of this: https://stackoverflow.com/questions/21715268/list-returned-by-map-function-disappears-after-one-use
To get the formatting to look right in my command prompt I took out the encode command on the last line:
print(linebuf)