我正在尝试将方法绑定到我的Traceback (most recent call last):
File "/Users/CosmoCrash/opencvblobs/lib/python3.7/site-packages/tifffile/tifffile.py", line 2236, in __init__
byteorder = {b'II': '<', b'MM': '>'}[header[:2]]
KeyError: b'\x89P'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "gfp.py", line 6, in <module>
binary_img = tifffile.imread('organoid_images/gfp/cells1.tif')
File "/Users/CosmoCrash/opencvblobs/lib/python3.7/site-packages/tifffile/tifffile.py", line 715, in imread
with TiffFile(files, **kwargs_file) as tif:
File "/Users/CosmoCrash/opencvblobs/lib/python3.7/site-packages/tifffile/tifffile.py", line 2238, in __init__
raise TiffFileError('not a TIFF file')
tifffile.tifffile.TiffFileError: not a TIFF file
路由,因此我在有关此问题的其他一些帖子的代码中做了一些更改,但是我什么都无法工作。
我使用feathersJS的express实现,但是即使使用express,我仍然遇到相同的错误。任何帮助将不胜感激。
app.js
/userAuthenticationInfo
AnnotatorService.js
const feathers = require('@feathersjs/feathers');
const express = require('@feathersjs/express');
const nano = require('cloudant-nano');
const AnnotatorService = require('./services/api/AnnotatorService');
const app = express(feathers())
.configure(express.rest())
.use(express.json())
.use(express.urlencoded({ extended: true }));
app.use('/userAuthenticationInfo', AnnotatorService.getUserAuthenticationInfo('bobby', app));
错误日志
const nano = require('cloudant-nano');
const couchdbservice = require('@kapmug/feathers-nano/lib/index');
const host = process.env.DB_HOST || '127.0.0.1:5984';
const auth = `${process.env.DB_USERNAME || 'admin'}:${process.env.DB_PASSWORD || 'welcome'}`;
const opts = {
url: `http://${auth}@${host}`,
};
const options = {
name: 'users',
connection: nano(opts),
database: 'users',
paginate: {
default: 5,
max: 200,
},
};
var params = {
limit: 5,
skip: 0,
};
module.exports.getUserAuthenticationInfo = function (username, app) {
console.log('mission accomplished');
};
答案 0 :(得分:1)
在app.use
函数中,您需要放置一个中间件函数(指针),其声明如下:
function(req, res, next){ ... }
但是,通过放置AnnotatorService.getUserAuthenticationInfo('bobby', app)
,您实际上是在调用该函数,该函数什么也不返回,因此undefined
。
应该,
module.exports.getUserAuthenticationInfo = function (username, app) {
return function(req, res, next){
console.log('mission accomplished');
next()//or res.end() or res.send() whatever
}
};