I am trying to script automatic payments without hosting a full node (my server doesn't have enough harddrive space). To do this I'm using electrum's python interface, and I have created a transaction, but when I try to send it, I get the error message: "TX rejected", "code: -22". Looking that up here, it appears that's an error either parsing or validating the transaction. It appears the error was thrown here.
But I cannot determine why. The transaction contains 2 inputs, 2 outputs, and the outputs + fee of 0.0001 = the size of the inputs (as of now) as verified via blockchain.info. The size of the transaction is under 1kb, so the fee is as I understand .0001. I sent an earlier transaction of .0001 with a .0001 fee through the electrum UI and it went through fine. So why is this transaction failing?
The raw transaction is:
01000000029802316bd53cdef6741b40b0a75cbffdfab270b0804f32096dda42594e19d179010000008b483045022100bd8bebb8491689604203806b66dc8c785cfb2362f2af630550bcd08d8789311c0220762ed5f310a15294e4fa9a5da9c4baff19e0f7c74a37430676fa3f7af3b50bb6014104f58c3d2d51eebf504ce13e1f5d3bb6f80c3df2e60212fef826dc2ce5bbe5f833b7ef684005fc6c28f80d7f27f70333471099edd4d41f4176261ae345a4128c46ffffffffd133f259c5e4bc4213136acb2fc4dbe5234732cfbfcc6a2845b83a744ea90e000e0000008b483045022100ec66b8827e4827b63a66840b1976cfc244a5ab20a047dd0d23e33285f63d7967022030c8f4b78277747dce2b085cf84acdd990704b0568c4d6e130a2361892b58e8d014104f58c3d2d51eebf504ce13e1f5d3bb6f80c3df2e60212fef826dc2ce5bbe5f833b7ef684005fc6c28f80d7f27f70333471099edd4d41f4176261ae345a4128c46ffffffff02a00f0000000000001976a9147d7cc528123aca5b820013445abbdff7530db71488ace01f0000000000001976a914742415bbd2c023df6f47e1fb6f5dac5316dc437588ac00000000
and I uploaded the decoded version (using electrum decoderawtransaction ...
or https://coinb.in/decode-raw-transaction.html - both give the same output) here