My question involves bankruptcy in the state of: Pennsylvania

I am facing a law suit from my ex wife and her lawyer because when we sold our home we sold it at a $5000.00 loss which she paid for at the closing even though I told her I didnt agree with selling it at that kind of loss. I plan to fight it the best I can in court since I cant afford legal fees anymore I have to do my homework. My question is bacially if I do lose and they get a judgement against me for the $5k and the $1k for her lawyer fees they are asking for, can I file bankruptcy to discharge this judgment? I also have a huge balance of credit card debt and old utility debt I havent paid on in 2 years. I should note we had a personal agreement before the divorce that we typed out saying when I lived there I would be responsible for making payments and maintainace but I did move out a few months before the sale so I wasnt living there. The potential buyer moved in and was supposed to be paying her some kind of rent that i wasnt involved in. I only missed 1 payment of the mortgage while I lived there.