我在尝试使用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
以下异常:
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”,它将按预期工作。
当我的飞镖项目中使用第三方JavaScript库,我手动经过库的文档,并通过其属性和方法遍历一系列繁琐打造达特代码context和callMethod电话. 有没有人想出一种自动化方法?
我试图找到一个内省JavaScript库的命令行界面,以便我可以自动生成Dart源代码.我的搜索一直没有成功.
使用新的测试库来测试Dart Polymer元素,我my_element_test.html 按照规定构建.请参阅我的回购:聚合物飞镖测试.
my_element_test.html和my_element_test.dart(注释掉聚合物启动)按预期通过测试:
<!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)
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 …我可能会错误地创建流并因此创建媒体实例吗?
修改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)