Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
linghp opened this issue Dec 31, 2015 · 21 comments
Open

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

linghp opened this issue Dec 31, 2015 · 21 comments

Comments

@linghp
Copy link

linghp commented Dec 31, 2015

No description provided.

@JakeWharton
Copy link
Owner

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

@notsatyarth
Copy link

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

@jsbeckr
Copy link

jsbeckr commented Feb 28, 2016

Easiest is to install cygwin and use its terminal.

@notsatyarth
Copy link

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?

@sergiiz
Copy link

sergiiz commented Apr 15, 2016

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

@notsatyarth
Copy link

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

@castrojr913
Copy link

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

@notsatyarth
Copy link

@castrojr913 ,I used 3.4.4

@liouvilles
Copy link

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

@Nexen23
Copy link

Nexen23 commented Oct 8, 2016

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
Copy link

Nexen23 commented Oct 8, 2016

As @jsbeckr suggested, only cygwin helped

@namchuai
Copy link

namchuai commented Jan 5, 2017

Using cmder
http://cmder.net/

@yygutn
Copy link

yygutn commented Jun 19, 2017

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

@gmkado
Copy link

gmkado commented Sep 10, 2017

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)

@barryzzz
Copy link

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

@ericksprengel
Copy link

ericksprengel commented Jan 23, 2018

I'm using in cygwin, but I needed to revert this change: 6b6034a

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
Copy link

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

@Torvin
Copy link

Torvin commented Feb 4, 2018

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.

jeremy-techson added a commit to jeremy-techson/pidcat that referenced this issue Apr 19, 2018
@Torvin
Copy link

Torvin commented Mar 5, 2019

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?

@nicolasjafelle
Copy link

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

@watery
Copy link

watery commented Feb 12, 2020

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests