在Meteor,我正在编写一个方法,必须检查某个路径的子目录的新文件.我首先想列出其中的子目录,Meteor之后是child_process.exec一个简单的bash脚本,列出自上次执行以来添加的文件.
我在将目录发现设置为async(Error: Can't wait without a fiber)时遇到了一些问题.我已经编写了一个同步版本但是同时使用它们fs.readdir而fs.stat不是它们的同步替代版本允许我捕获错误.
这是代码:
function listDirs(dir, isDir){
var future1 = new Future();fs.readdir(dir, function(err, files){
if (err)
throw new Meteor.error(500, "Error listing files", err);
var dirs = _.map(files, function(file){
var future2 = new Future();
var resolve2 = future2.resolver();
fs.stat(dir+file, function(err, stats){
if (err)
throw new Meteor.error(500, "Error statting files", err);
if (stats.isDirectory() == isDir && file.charAt(0) !== '.')
resolve2(err, file);
});
return future2;
});
Future.wait(dirs); …Run Code Online (Sandbox Code Playgroud) 这里有新的emacs/python用户.
我正努力开始flycheck工作(和使用flake8).
这是我的相关部分init.el:
(require 'python-mode)
(add-to-list 'auto-mode-alist '("\\.py$" . python-mode))
(add-hook 'python-mode-hook 'flycheck-mode)
Run Code Online (Sandbox Code Playgroud)
当我打开python文件时,我的模式行包括Py FlyC-
From the Flycheck手册,我了解到这意味着Flycheck无法自动找到合适的检查器.
当我运行M-x flycheck-select-checker并选择python-flake8它返回:
Configured syntax checker python-flake8 cannot be used
Run Code Online (Sandbox Code Playgroud)
我正在使用OSX 10.9 homebrew和这些版本:
$ emacs --version
GNU Emacs 24.3.50.1
$ flake8 --version
2.1.0 (pep8: 1.4.6, pyflakes: 0.7.3, mccabe: 0.2.1) CPython 2.7.5 on Darwin
$ which flake8
/usr/local/bin/flake8
$ python --version
Python 2.7.5
$ which python
/usr/local/bin/python …Run Code Online (Sandbox Code Playgroud)