小编Dam*_*mon的帖子

Google Drive Drive Quickstart示例中的"ImportError:无法导入name util"错误

我在尝试使用Google云端硬盘SDK快速入门示例(https://developers.google.com/drive/quickstart)时收到以下错误消息.

Traceback (most recent call last):
  File "quickstart.py", line 6, in <module>
    from apiclient.discovery import build
  File "build/bdist.macosx-10.6-intel/egg/apiclient/discovery.py", line 45, in <module>
  File "build/bdist.macosx-10.6-intel/egg/apiclient/errors.py", line 26, in <module>
ImportError: cannot import name util
Run Code Online (Sandbox Code Playgroud)

正如教程中所解释的,首先在我的Mac终端上我:

easy_install --upgrade google-api-python-client
Run Code Online (Sandbox Code Playgroud)

我使用的是Mac OS 10.7.4 python 2.7.2

python google-drive-api google-api-python-client

6
推荐指数
1
解决办法
2076
查看次数

SocketIOException:客户端中出现意外的握手错误

以下异常:

SocketIOException: Unexpected handshake error in client (OS Error: errno = -12268)
#0      _SecureFilterImpl.handshake (dart:io-patch:849:8)
#1      _SecureSocket._secureHandshake (dart:io:7382:28)
#2      _SecureSocket._secureConnectHandler._secureConnectHandler (dart:io:7294:21)
#3      _Socket._updateOutHandler.firstWriteHandler (dart:io-patch:773:64)
#4      _SocketBase._multiplex (dart:io-patch:408:26)
#5      _SocketBase._sendToEventHandler.<anonymous closure> (dart:io-patch:509:20)
#6      _ReceivePortImpl._handleMessage (dart:isolate-patch:37:92)
Run Code Online (Sandbox Code Playgroud)

以下代码的结果:

SocketIOException: Unexpected handshake error in client (OS Error: errno = -12268)
#0      _SecureFilterImpl.handshake (dart:io-patch:849:8)
#1      _SecureSocket._secureHandshake (dart:io:7382:28)
#2      _SecureSocket._secureConnectHandler._secureConnectHandler (dart:io:7294:21)
#3      _Socket._updateOutHandler.firstWriteHandler (dart:io-patch:773:64)
#4      _SocketBase._multiplex (dart:io-patch:408:26)
#5      _SocketBase._sendToEventHandler.<anonymous closure> (dart:io-patch:509:20)
#6      _ReceivePortImpl._handleMessage (dart:isolate-patch:37:92)
Run Code Online (Sandbox Code Playgroud)

请注意,如果我将 url 替换为“http”而不是“https”,它将按预期工作。

错误报告在这里。

https dart

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

在Dart中自动化JavaScript Interop

当我的飞镖项目中使用第三方JavaScript库,我手动经过库的文档,并通过其属性和方法遍历一系列繁琐打造达特代码contextcallMethod电话. 有没有人想出一种自动化方法?

我试图找到一个内省JavaScript库的命令行界面,以便我可以自动生成Dart源代码.我的搜索一直没有成功.

auto-generate dart dart-js-interop

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

如何使用新的测试库测试Dart Polymer元素?

如何使用新的测试库测试Polymer元素?

使用新的测试库来测试Dart Polymer元素,我my_element_test.html 按照规定构建.请参阅我的回购:聚合物飞镖测试.

没有聚合物引发通过

my_element_test.htmlmy_element_test.dart(注释掉聚合物启动)按预期通过测试:

my_element_test.html

<!doctype html>
<html>
  <head>
    <title>My Element Test</title>
    <link rel="import" href="packages/polymer_dart_testing/my_element.html">
    <link rel="x-dart-test" href="my_element_test.dart">
    <script src="packages/test/dart.js"></script>
  </head>
  <body>
    <div>Custom HTML Test is Custom.</div>
    <my-element></my-element>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

my_element_test.dart

import 'package:test/test.dart';
import 'package:polymer_dart_testing/my_element.dart';
import 'package:polymer/polymer.dart';

import 'dart:html';

main() {

  setUp(() async {
    // await initPolymer();
    // return await Polymer.onReady;
  });

  test('custom_html_test', (){
    expect(true, isTrue);
  });
}
Run Code Online (Sandbox Code Playgroud)

pub run test...在添加test/my_element_test.html …

testing unit-testing dart dart-polymer

4
推荐指数
1
解决办法
233
查看次数

未捕获的错误:类'int'没有实例获取方法'length'

我可能会错误地创建流并因此创建媒体实例吗?

修改googleapis_examples / drive_upload_download_console时,我正在尝试将已存储的.docx,.xlsx等文件转换为对应的Google Drive。

以下代码

import 'dart:async';
import 'dart:io';

import 'package:http/http.dart' show Client;
import 'package:googleapis/common/common.dart' show Media, DownloadOptions;
import 'package:googleapis/drive/v2.dart' as drive;
import 'package:path/path.dart' as path;

Future convertFile(drive.DriveApi api, 
                    Client client, 
                    String objectId) {
  var completer = new Completer();
  api.files.get(objectId).then((drive.File file) {
    var fileName = path.basenameWithoutExtension(file.title);
    var parents = file.parents;

    client.readBytes(file.downloadUrl).then((bytes) {
      var driveFile = new drive.File()
      ..title = fileName
      ..mimeType = 'application/vnd.google-apps.document'
      ..parents = parents;
      api.files.insert(driveFile)
      .then((driveFile){
        var byteList = bytes.toList();
        var stream = new Stream.fromIterable(byteList); …
Run Code Online (Sandbox Code Playgroud)

dart google-drive-api google-apis-explorer

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