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

Support for magic method %load #104

Closed
cpaulik opened this issue Jul 8, 2016 · 4 comments
Closed

Support for magic method %load #104

cpaulik opened this issue Jul 8, 2016 · 4 comments
Assignees
Labels

Comments

@cpaulik
Copy link

cpaulik commented Jul 8, 2016

Just ran into a notebook that loaded some code from an external python file. Executing this in emacs did nothing.

@millejoh
Copy link
Owner

millejoh commented Jul 9, 2016

Could you attach a copy or provide a link the notebook in question? I haven't used %load much but what I remember is that the search path in the notebook is not always what one would expect.
John

On Fri, Jul 8, 2016 at 9:43 AM -0500, "Christoph Paulik" [email protected] wrote:

Just ran into a notebook that loaded some code from an external python file. Executing this in emacs did nothing.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@cpaulik
Copy link
Author

cpaulik commented Jul 9, 2016

https://github.com/dask/dask-tutorial/blob/master/01-Array.ipynb it's the 5th cell or so down where the first solution is loaded.

@millejoh
Copy link
Owner

Looks like the behavior should be that the cell executing %load gets its contents replaced by whatever is in the file being loaded. Interesting.

On debugging I can see the following gets sent back by the ipython kernel. I guess EIN needs to start looking for payload attributes in execute_reply messages. Unfortunately free time has been short lately, not sure when I will get around to implementing this.

{
  "metadata": {
    "started": "2016-07-12T20:38:37.066452",
    "engine": "214108de-b808-4ab3-ac01-3b839173611a",
    "status": "ok",
    "dependencies_met": true
  },
  "header": {
    "username": "username",
    "date": "2016-07-12T20:38:37.085454",
    "version": "5.0",
    "msg_type": "execute_reply",
    "msg_id": "3b9af6cc-f057-41a8-8de4-f668469fb007",
    "session": "4419cd77-079a-4112-975f-1e710409c78b"
  },
  "msg_type": "execute_reply",
  "msg_id": "3b9af6cc-f057-41a8-8de4-f668469fb007",
  "channel": "shell",
  "parent_header": {
    "username": "username",
    "date": "2016-07-12T20:38:37.062451",
    "version": "5.0",
    "msg_type": "execute_request",
    "msg_id": "5ad749b4-5a90-45bf-9fe1-ffb314c72270",
    "session": "2acb274f-e232-4855-af0b-0575502166cf"
  },
  "buffers": [],
  "content": {
    "execution_count": 26,
    "payload": [
      {
        "source": "set_next_input",
        "text": "# %load solutions\/Array-01.py\nsums = []\nlengths = []\nfor i in range(0, 1000000000, 1000000):\n    chunk = dset[i: i + 1000000]  # pull out numpy array\n    sums.append(chunk.sum())\n    lengths.append(len(chunk))\n\ntotal = sum(sums)\nlength = sum(lengths)\nprint(total \/ length)\n",
        "replace": true
      }
    ],
    "user_expressions": {},
    "status": "ok"
  }
}

@millejoh millejoh added the bug label Aug 16, 2016
@millejoh millejoh self-assigned this Dec 17, 2016
@millejoh
Copy link
Owner

Okay - think this may be working now. And only a 5 month turnaround! Mom would be so proud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants