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

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

Open
kaushikacharya opened this issue Dec 20, 2019 · 6 comments
Open

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

kaushikacharya opened this issue Dec 20, 2019 · 6 comments

Comments

@kaushikacharya
Copy link

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.

@stevkalinowski
Copy link

stevkalinowski commented Jun 16, 2020

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"

@kaushikacharya
Copy link
Author

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

@stevkalinowski
Copy link

Sweet, thanks, I'll check it out.

kaushikacharya added a commit to kaushikacharya/runsnakerun that referenced this issue Jun 19, 2020
@kaushikacharya
Copy link
Author

@mcfletch
I have fixed the issue and have raised the pull request: #5

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

@stevkalinowski
Copy link

Awesome, thanks!

@stevkalinowski
Copy link

Beautiful, totally work for me!

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

2 participants