Skip to content

ValueError: not enough values to unpack (expected 2, got 1) #210

Closed

Description

@SamuelXJames

I am unable to run mprof plot. I get the above value error instead which is due to line 312 in mprof,py
which is: field, value = l.split(' ', 1).

I am currently running memory_profiler as: python -m memory_profiler mprof plot in command. Mprof run works as intended.

Activity

  1. SamuelXJames commented on Sep 5, 2018

    @SamuelXJames
    Author

    Mprof is unable to parse white space, therefore blank lines need to be deleted.

  2. astrojuanlu commented on Sep 5, 2018

    @astrojuanlu
    Collaborator

    Mprof is unable to parse white space, therefore blank lines need to be deleted.

    This is weird, could you please post a sample program so we can reproduce the issue?

  3. stepan-anokhin commented on Sep 16, 2022

    @stepan-anokhin

    @astrojuanlu The problem occurs when mprof run <command> has multi-line arguments:

    For example:

    read -r -d '' MESSAGE << EOM            
      hello
      world
    EOM
    
    mprof run echo "$MESSAGE"
    mprof plot
    Using last profile data.
    Traceback (most recent call last):
      File "/home/stepan/mprof-example/venv/bin/mprof", line 8, in <module>
        sys.exit(main())
      File "/home/stepan/mprof-example/venv/lib/python3.8/site-packages/mprof.py", line 905, in main
        actions[get_action()]()
      File "/home/stepan/mprof-example/venv/lib/python3.8/site-packages/mprof.py", line 819, in plot_action
        mprofile = plotter(filename, index=n, timestamps=timestamps, options=args)
      File "/home/stepan/mprof-example/venv/lib/python3.8/site-packages/mprof.py", line 409, in plot_file
        mprofile = read_mprofile_file(filename)
      File "/home/stepan/mprof-example/venv/lib/python3.8/site-packages/mprof.py", line 364, in read_mprofile_file
        field, value = l.split(' ', 1)
    ValueError: not enough values to unpack (expected 2, got 1)
    

    Version:

    pip show memory-profiler
    Name: memory-profiler
    Version: 0.60.0
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions