pidcat icon indicating copy to clipboard operation
pidcat copied to clipboard

in windows,how to use? search anywhere,nothing.

Open linghp opened this issue 9 years ago • 21 comments

linghp avatar Dec 31 '15 08:12 linghp

It's just a python script. You can run with python pidcat.py.

JakeWharton avatar Dec 31 '15 19:12 JakeWharton

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

notsatyarth avatar Feb 10 '16 13:02 notsatyarth

Easiest is to install cygwin and use its terminal.

jsbeckr avatar Feb 28 '16 10:02 jsbeckr

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?

notsatyarth avatar Mar 01 '16 12:03 notsatyarth

Same here, how to setup colored text output for Windows without cygwin?

sergiiz avatar Apr 15 '16 10:04 sergiiz

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

notsatyarth avatar Apr 15 '16 13:04 notsatyarth

@droidekas Which version of python did you try? I tried with 2.7 and 3.2, it doesn't work.

castrojr913 avatar Aug 17 '16 00:08 castrojr913

@castrojr913 ,I used 3.4.4

notsatyarth avatar Aug 17 '16 05:08 notsatyarth

i run python pidcat.py in windows but it doesn't work

liouvilles avatar Sep 13 '16 15:09 liouvilles

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).

Nexen23 avatar Oct 08 '16 16:10 Nexen23

As @jsbeckr suggested, only cygwin helped

Nexen23 avatar Oct 08 '16 17:10 Nexen23

Using cmder http://cmder.net/

namchuai avatar Jan 05 '17 06:01 namchuai

i tried cmder/cygwin/powershell however, python pidcat.py apptag no output my python version is 3.5

yygutn avatar Jun 19 '17 04:06 yygutn

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)

gmkado avatar Sep 10 '17 18:09 gmkado

i run python pidcat.py com.oprah.bees.android in windows but it doesn't work

barryzzz avatar Oct 24 '17 03:10 barryzzz

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: image

bytes: image

P.S.: I'm using python 3.6.4

ericksprengel avatar Jan 23 '18 12:01 ericksprengel

Before start trying with "Bash On Ubuntu On Windows", please check if it was added support to USB devices: https://askubuntu.com/a/826642

ericksprengel avatar Jan 23 '18 13:01 ericksprengel

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.

Torvin avatar Feb 04 '18 08:02 Torvin

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 avatar Mar 05 '19 00:03 Torvin

@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!

nicolasjafelle avatar Sep 09 '19 14:09 nicolasjafelle

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)

watery avatar Feb 12 '20 09:02 watery