runsnakerun icon indicating copy to clipboard operation
runsnakerun copied to clipboard

TypeError: sequence index must be integer, not 'slice'

Open kaushikacharya opened this issue 5 years ago • 6 comments

Environment:

OS: Windows 7 RunSnakeRun 2.0.5 Python 2.7.15 :: Anaconda, Inc.

I had followed the example to dump profile output as mentioned in https://kupczynski.info/2015/01/16/profiling-python-scripts.html

import multiprocessing
import cProfile
import time

def worker(num):
    time.sleep(3)
    print 'Worker:', num

def profile_worker(num):
    cProfile.runctx('worker(num)', globals(), locals(), 'profile-%d.out' %num)


if __name__ == '__main__':
    for i in range(5):
        p = multiprocessing.Process(target=profile_worker, args=(i,))
        p.start()

But when I execute runsnakerun over the profile dump, I get the following error:

$ runsnake profile-0.out
Traceback (most recent call last):
  File "c:\anaconda2\lib\site-packages\runsnakerun\runsnake.py", line 836, in OnInit
    frame = MainFrame(config_parser=load_config())
  File "c:\anaconda2\lib\site-packages\runsnakerun\runsnake.py", line 216, in __init__
    self.CreateControls(config_parser)
  File "c:\anaconda2\lib\site-packages\runsnakerun\runsnake.py", line 230, in CreateControls
    self.leftSplitter, columns=PROFILE_VIEW_COLUMNS, name='mainlist',
  File "c:\anaconda2\lib\site-packages\runsnakerun\listviews.py", line 99, in __init__
    self.CreateControls()
  File "c:\anaconda2\lib\site-packages\runsnakerun\listviews.py", line 117, in CreateControls
    self.CreateColumns()
  File "c:\anaconda2\lib\site-packages\runsnakerun\listviews.py", line 123, in CreateColumns
    for i in range(self.GetColumnCount())[::-1]:
TypeError: sequence index must be integer, not 'slice'
OnInit returned false, exiting...

Have got the above error while running in gitbash. Whereas on executing in windows cmd, it does nothing.

Is there any installation issue?

Though I guess it shouldn't matter, but FYI, I had dumped profile output in Ubuntu and was trying to execute runsnake on Windows.

kaushikacharya avatar Dec 20 '19 17:12 kaushikacharya

OS: Windows 10 Python 2.7 RunSnakeRun 2.0.5 Install with pip

I get this error too. My profile was generated from python embedded in the application Motionbuilder 2017 so I'm not sure if that makes a difference. I created my profile file with "cProfile.runctx"

stevkalinowski avatar Jun 16 '20 17:06 stevkalinowski

@stevkalinowski

I get this error too.

I moved into another library called SnakeViz. This was suggested by jiffyclub in https://stackoverflow.com/questions/3378953/is-there-a-visual-profiler-for-python This creates visual profiling in Windows.

kaushikacharya avatar Jun 17 '20 13:06 kaushikacharya

Sweet, thanks, I'll check it out.

stevkalinowski avatar Jun 17 '20 15:06 stevkalinowski

@mcfletch I have fixed the issue and have raised the pull request: https://github.com/mcfletch/runsnakerun/pull/5

@stevkalinowski You can check whether the changes work for you.

kaushikacharya avatar Jun 19 '20 11:06 kaushikacharya

Awesome, thanks!

stevkalinowski avatar Jun 19 '20 15:06 stevkalinowski

Beautiful, totally work for me!

stevkalinowski avatar Jun 19 '20 17:06 stevkalinowski