rkern / line_profiler

(OLD REPO) Line-by-line profiling for Python - Current repo ->
https://github.com/pyutils/line_profiler
Other
3.6k stars 256 forks source link

_pickle.UnpicklingError: invalid load key #182

Closed Jakobhenningjensen closed 4 years ago

Jakobhenningjensen commented 4 years ago

I have a test.py script which I try to profile. I have tried writing it is a function (*) and also as pure-lines (**) When I run python -m line_profiler test.py I get the error _pickle.UnpicklingError: invalid load key, <key> (where <key> changes depending on the script).

Am I missing something here? I have also tried adding @profile to the function

I am running:

Python - 3.7 OS - Windows 10

and have installed line_profiler using the git-clone workaround

 (*)def main():

      i=0
      for _ in range(1000000):
            i+=1

if __name__=="__main__":
      main()

(**)
      i=0
      for _ in range(1000000):
            i+=1
rkern commented 4 years ago

As described in the README, python -m line_profiler <file> loads a line-profile dump for visualization. The kernprof script is the one that runs the profiler on a script.

Please go to the current repository for more issues: https://github.com/pyutils/line_profiler