简体   繁体   中英

Simple Python Statement Fails Every Other time

I'm using libais, a very simple library to process marine AIS messages. I've used this a lot and I'm sure my code is ok. Using REPL:

import ais
msg = '177KQJ5000G?tO`K>RA1wUbN0TKH'   # a valid AIS encoded string
ais.decode(msg)  # this will succeed
ais.decode(msg)  # this will fail
ais.decode(msg)  # this will succeed
ais.decode(msg)  # this will fail, etc

by fail I mean I will get the error: TypeError: Function takes exactly 2 arguments (1 given)

This is such weird behavior I'm thinking it's related to my environment. I think this started happening right after I installed (then removed) Anaconda. My platform is RHEL7. I've deleted and reinstalled libais. Short of rebuilding this server, I'm not sure what else to do. Any thoughts on how to troubleshoot a "works every other time" error?

Thanks folks. I consider this "solved" so I'm accepting the answer that the library is to blame, when I originally thought it was a corrupt python installation. I was not using the (allegedly optional) second parameter. I am now, and everything works fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM