I use IbPy and wanted to share a rather odd occurrence as it lacks online documentation. I am using an older TWS version 972, so this may only be of use to people using older versions of the API.
I took my IbPy working code offline, and then I used the Rebalance Portfolio tool in TWS to adjust my positions to a new target leverage quickly. I then went to resume my python script and ran into a brand new error with no useful searches online for info or documentation:
ERROR: <error id=-1, errorCode=2151, errorMsg=Positions info is not available yet>
This error occured when I attempted to request positions(reqPositions) from the account. It failed until I rebooted the TWS application. A pretty simple fix, but I wanted to share in case anyone ran into a similar problem and had more info to share.
Thank you.