3

i am trying to use of systrace. for this, i am reading official site.

but after run this command on terminal :

D:\Software\Android\android-sdk\platform-tools\systrace>python systrace.py --time=10 -o mynewtrace.html sched gfx view wm

I got these error:

Traceback (most recent call last):
File "systrace.py", line 48, in <module>
from systrace import run_systrace
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py", line 40, in <module>
from devil import devil_env
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\systrace\systrace\..\..\devil\devil\devil_env.py", line 32, in <module>
import dependency_manager  # pylint: disable=import-error
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\dependency_manager\dependency_manager\__init__.py", line 28, in <module>
from .archive_info import ArchiveInfo
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\dependency_manager\dependency_manager\archive_info.py", line 7, in <module>
from dependency_manager import exceptions
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\dependency_manager\dependency_manager\exceptions.py", line 5, in <module>
from py_utils import cloud_storage
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\common\py_utils\py_utils\cloud_storage.py", line 20, in <module>
from py_utils import lock
File "D:\Software\Android\android-sdk\platform-tools\systrace\catapult\common\py_utils\py_utils\lock.py", line 18, in <module>
import win32con    # pylint: disable=import-error
ImportError: No module named win32con

my python version:

D:\Software\Android\android-sdk\platform-tools\systrace>python --version
Python 2.7.13

D:\Software\Android\android-sdk\platform-tools\systrace>

I have added python PATH to ** system ENVIRONMENT** . my main goal of use Systrace by command is using of Tracing Application Code. I put:

Trace.beginSection("MyAdapter.onCreateViewHolder");

and

Trace.endSection();

to my code and i want to see this output as a trace to systrace by -a or --app= options.

GUI systrace is ok on google chrome and work excellent in this browser.

sayres kabir
  • 362
  • 4
  • 22

5 Answers5

3

python doesn't come with pywin32 library. you just need to download pywin32 version according to your system from here https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/ and install it. It will work.

Vikram
  • 139
  • 11
1

For me, running

pip install pypiwin32

fixed the problem

ghodir
  • 11
  • 2
1

My error stacktrace

 C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace>python
 systrace.py --time=10 -o my_systrace.html Traceback (most recent call
 last):   File "systrace.py", line 48, in <module>
     from systrace import run_systrace   File "C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\run_systrace.py",
 line 43, in <module>
     from systrace import systrace_runner   File "C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\systrace_runner.py",
 line 11, in <module>
     from systrace import output_generator   File "C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\systrace\systrace\output_generator.py",
 line 15, in <module>
     from tracing.trace_data import trace_data   File "C:\Users\hhh\AppData\Local\Android\Sdk\platform-tools\systrace\catapult\tracing\tracing\trace_data\trace_data.py",
 line 17, in <module>
     import six ImportError: No module named six

I solved the problem:

pip install six

summary
find ImportError what, use pip install it

zhisme
  • 2,368
  • 2
  • 19
  • 28
wanghaha
  • 11
  • 3
0

In Windows10 when running through the command line, I got the same errors!

But if run systrace from Android Device Monitor all work fine!

To do this:

  • run Android Device Monitor
  • click DDMS icon
  • in the "Devices" tab select your device
  • click "Capture system wide trace using Android systrace" (Near the icon " Screen Capture")

I use Android Device Monitor Version: 25.2.2

ArkadiBernov
  • 570
  • 8
  • 13
0

In my case I was using Python 3.8, I just switched to 2.7.

Boitshoko
  • 1
  • 1