我正在尝试按照this tutorial
构建简单的Rest网络服务但是当我在Eclipse上运行这个项目时,会出现一个错误:
def timed_cache(cache_time:int, nullable:bool=False):
result = ''
timeout = 0
def decorator(function):
def wrapper(*args, **kwargs):
nonlocal result
nonlocal timeout
if timeout <= time.time() or not (nullable or result):
result = function(*args, **kwargs)
timeout = time.time() + cache_time
return result
return wrapper
return decorator
有人可以告诉我哪里错了吗?先感谢您。抱歉我的英文不好
答案 0 :(得分:0)
在一些打开的依赖项更新为新版本后,我的Maven项目中出现了相同的错误。就我而言,他们是
google.load('visualization', '1', {packages: ['treemap'], callback: drawVisualization});
function drawVisualization() {
// Create and populate the data table.
var dataArray = [];
dataArray.push(['Department Name', 'Parent', 'Number of Goals', 'color']);
dataArray.push(['Goals by Team', null, 0, 0]);
dataArray.push(['Sales', 'Goals by Team', 2, 'red']);
dataArray.push(['Finance', 'Goals by Team', 6, 'green']);
dataArray.push(['Pre-Sales', 'Goals by Team', 8, 'red']);
dataArray.push(['Technology', 'Goals by Team', 4, 'amber']);
dataArray.push(['Management', 'Goals by Team', 1, 'amber']);
var data = google.visualization.arrayToDataTable(dataArray);
// Create and draw the visualization.
var treemap = new google.visualization.TreeMap(document.getElementById('visualization'));
treemap.draw(data, {
minColor: 'red',
midColor: 'orange',
maxColor: 'green',
headerHeight: 0,
fontColor: 'black',
showScale: true});
google.visualization.events.addListener(treemap, 'select', showGoalsByDepartment);
google.visualization.events.trigger(treemap, 'select', null);
function showGoalsByDepartment() {
var selection = treemap.getSelection();
if (selection && selection.length > 0) {
var node_name = data.getValue(selection[0].row, 0);
$location.path('departmentGoal/'+node_name);
$scope.$apply();
}
}
}
分别下载了
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>[1.3.2,)</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>[3.0.1,)</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>[2.5.0,)</version>
</dependency>
我在Maven资源库中搜索了JAR的历史记录(通常是mybatis-spring-2.0.0-SNAPSHOT.jar
mybatis-3.5.0-SNAPSHOT.jar
eclipselink-3.0.0-SNAPSHOT.jar
之类的),发现所有JAR都是在我收到此错误之日更新的。
我在{user-home}/.m2/repository
中使用“封闭”依赖性恢复了JAR的先前版本,即:
pom.xml
然后更新依赖项。 Maven已下载
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>**2.5.0**</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>**1.3.2**</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>**3.4.6**</version>
</dependency>
相反,一切正常。
甚至不知道您是否正在使用pom.xml(Maven项目),但是您当然正在运行Tomcat,因此请检查您的内部是否存在一些不兼容或最近修改过的jar版本
mybatis-spring-1.3.2.jar
mybatis-3.4.6.jar
eclipselink-2.5.0.jar
或者您的网络应用
{catalina.base}/lib
希望这会有所帮助。