Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instance_id error #37

Open
467754239 opened this issue Mar 21, 2017 · 1 comment
Open

instance_id error #37

467754239 opened this issue Mar 21, 2017 · 1 comment

Comments

@467754239
Copy link

467754239 commented Mar 21, 2017

get_instance(instance_id)

errormsg:

ValueError Traceback (most recent call last)
in ()
----> 1 conn.get_instance(instance_ids[0])

/data/xxxx/lib/python2.7/site-packages/Aliyun-1.1.0-py2.7.egg/aliyun/ecs/connection.pyc in get_instance(self, instance_id)
184 int(resp['InternetMaxBandwidthOut']),
185 dateutil.parser.parse(resp['CreationTime']),
--> 186 dateutil.parser.parse(resp['ExpiredTime']),
187 resp['InstanceChargeType'],
188 resp['Description'],

/data/xxx/lib/python2.7/site-packages/python_dateutil-2.6.0-py2.7.egg/dateutil/parser.pyc in parse(timestr, parserinfo, **kwargs)
1166 return parser(parserinfo).parse(timestr, **kwargs)
1167 else:
-> 1168 return DEFAULTPARSER.parse(timestr, **kwargs)
1169
1170

/data/xxx/lib/python2.7/site-packages/python_dateutil-2.6.0-py2.7.egg/dateutil/parser.pyc in parse(self, timestr, default, ignoretz, tzinfos, **kwargs)
560
561 if len(res) == 0:
--> 562 raise ValueError("String does not contain a date.")
563
564 repl = {}

ValueError: String does not contain a date.

@bayodesegun
Copy link

bayodesegun commented Mar 27, 2018

This error is coming from Line 186 of aliyun.ecs.connection.py, in the get_instance() method:

dateutil.parser.parse(resp['ExpiredTime']),

ExpiredTime will return an empty string if the instance has no ExpiredTime (this is very common).

This line of code can be improved to check this, I'll submit a pull request for that ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants