我想在Ipython Notebook 3.x或4.x(Jupyter,Python 3)中创建一个用于远程文件上传的小部件,允许用户在上传时在浏览器的文件选择器中选择多个文件.不幸的是,我对javascript方面一无所知.
我找到了blueimp的小部件,但是,我不知道如何在笔记本中使用它们.
这就是单个文件上传小部件的制作方式:
import base64
from __future__ import print_function # py 2.7 compat.
from IPython.html import widgets # Widget definitions.
from IPython.utils.traitlets import Unicode # Traitlet needed to add synced attributes to the widget.
Run Code Online (Sandbox Code Playgroud)
class FileWidget(widgets.DOMWidget):
_view_name = Unicode('FilePickerView', sync=True)
value = Unicode(sync=True)
filename = Unicode(sync=True)
def __init__(self, **kwargs):
"""Constructor"""
widgets.DOMWidget.__init__(self, **kwargs) # Call the base.
# Allow the user to register error callbacks with the following signatures:
# callback()
# callback(sender)
self.errors = …Run Code Online (Sandbox Code Playgroud) javascript widget multifile-uploader ipython-notebook jupyter
每当我从numpy导入一个模块时,我就会在Linux Mint Maya(Cinnamon)上的Eclipse 3.7.2 PyDev 2.7.1中收到"来自导入的未定义变量"错误.只有在导入numpy时才会出现问题; 其他模块工作正常.
信息:numpy是针对英特尔MKL库编译的.Python 2.7.3 [GCC 4.6.3]
例:
import numpy as np
a = np.array([1, 2])
Run Code Online (Sandbox Code Playgroud)
PyDev编辑器中的错误消息:"导入的未定义变量:数组"
我得到其他numpy子模块的类似错误.
代码在Eclipse或终端中正常运行.该问题仅出现在Eclipse-PyDev编辑器中.