小编tro*_*oyz的帖子

没有名为'pymysql'的模块

我正在尝试在Ubuntu上使用PyMySQL.

我已经安装了pymysql两个pip,pip3但每次使用import pymysql时都会返回ImportError: No module named 'pymysql'

我正在使用Ubuntu 15.10 64位和Python 3.5.

同样的.py可以在Windows上使用Python 3.5,但不适用于Ubuntu.

python ubuntu python-3.x pymysql

37
推荐指数
6
解决办法
8万
查看次数

Angular2嵌套路由器插座

我正在玩Angular 2,我遇到了路由器的麻烦.我想在主路由器插座内安装第二个路由器插座.

在第一个路由器插座内,我重定向到主页,我有第二个路由器插座:

<router-outlet name="main"></router-outlet>
Run Code Online (Sandbox Code Playgroud)

这是我没有导入的app.routing.

const appRoutes: Routes = [
    { path: '', component: HomeComponent },
    { path: 'login', component: LoginComponent},
    { path: 'days', component: DaysComponent, outlet: 'main'}
];

export const appRoutingProviders: any[] = [

];

export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
Run Code Online (Sandbox Code Playgroud)

在HomeComponent ngOnInit我有这个

this.router.navigateByUrl('/(main:days)');
Run Code Online (Sandbox Code Playgroud)

但这会导致网络崩溃,并出现以下错误:

未捕获(承诺):错误:找不到加载'DaysComponent'的插座主页

怎么可能在主要的内部有第二个路由器插座?

谢谢.

angular2-routing angular

9
推荐指数
1
解决办法
4670
查看次数

Sequelize更新

我正在尝试使用以下代码更新Sequelize中的模型:

exports.updateItem = function(item) {
    return new Promise((fulfill, reject) => {
        models.TimesheetItem.update(item,{where: {id: item.id}})
                            .then(fulfill)
                            .catch(console.dir);
     });
};
Run Code Online (Sandbox Code Playgroud)

其中item是执行models的结果.TimeSheetItem.find()

调用从不执行.then而是将空对象传递给.catch.

我查看了文档,似乎这是更新行的方法,但我无法让它工作.我究竟做错了什么?

谢谢!

node.js sequelize.js

7
推荐指数
1
解决办法
2万
查看次数

NodeJS pdfkit文本宽度

我正在尝试使用节点的 pdfkit 制作 PDF,但遇到一些与文本宽度相关的问题。

我想要的结果是这样的。

Overall comments:              This is the comment 
                               that will display here bla bla
                               extra text here 
Run Code Online (Sandbox Code Playgroud)

但我当前的代码得到的是这样的

Overall comments:              This is the comment
that will display here blab bla extra text here
Run Code Online (Sandbox Code Playgroud)

为了编写这段文字,我使用以下代码:

doc.font('Courier-Bold').text(padRight('Overall Comments:',28),{continued: true});
doc.font('Courier').text(audit.comment,{width: 100,align: 'justify'});
Run Code Online (Sandbox Code Playgroud)

其中audit.comment是右侧的文本,padRight返回固定大小为28的字符串,在右侧添加空格。

它似乎忽略了宽度选项或者我不知道如何使用它。

node.js node-pdfkit

5
推荐指数
1
解决办法
2163
查看次数