PyCharm Debugger does not display my class attributes

Answered

I have a class named "MatchedPurchase" with several attributes, however, the pycharm debugger does not display the attributes for any given instance of that class.
Here you can see that the object "mp" and list of objects in "matched" show nothing.

Even though the attributes are definted and will print out:

What am I doing wrong here?

0
7 comments

Have you checked under Special Variables?

For example:

 

0

UPD:

Shouldn't you unfold mp variable instead of matches?

0
Avatar
Permanently deleted user

Thank you for you're reply, if I understand correctly looking at the variable mp in the first screenshot you can see the arrow is facing down; but no attributes are displayed. I can toggle the arrow.

I tried again today with no success

And I couldn't find mp or matches in the Special Variables either:

0

Ahh, sorry, I didn't notice it.

Would it be possible to provide a code snippet and steps for reproducing the issue?
I can't reproduce it with my code based on your screenshots.

0
Avatar
Permanently deleted user

Ok, lets see I've paired down the project

 


sale0 = {'itemId': '224111461072', 'title': "1x Uro, Titan of Nature's Wrath Theros Beyond Death THB MTG NM", 'globalId': 'EBAY-US', 'primaryCategory': {'categoryId': '38292', 'categoryName': 'MTG Individual Cards'}, 'galleryURL': 'https://thumbs1.ebaystatic.com/m/mTbHa5hZhHeHH_vmkQkijNQ/140.jpg', 'viewItemURL': 'https://www.ebay.com/itm/1x-Uro-Titan-Natures-Wrath-Theros-Beyond-Death-THB-MTG-NM-/224111461072', 'paymentMethod': 'PayPal', 'autoPay': 'true', 'postalCode': '283**', 'location': 'Dudley,NC,USA', 'country': 'US', 'shippingInfo': {'shippingType': 'Calculated', 'shipToLocations': 'Worldwide', 'expeditedShipping': 'false', 'oneDayShippingAvailable': 'false', 'handlingTime': '2'}, 'sellingStatus': {'currentPrice': {'_currencyId': 'USD', 'value': '34.99'}, 'convertedCurrentPrice': {'_currencyId': 'USD', 'value': '34.99'}, 'sellingState': 'EndedWithSales'}, 'listingInfo': {'bestOfferEnabled': 'true', 'buyItNowAvailable': 'false', 'startTime': '2020-08-09T11:06:39.000Z', 'endTime': '2020-08-09T17:59:20.000Z', 'listingType': 'FixedPrice', 'gift': 'false'}, 'returnsAccepted': 'false', 'condition': {'conditionId': '1000', 'conditionDisplayName': 'New'}, 'isMultiVariationListing': 'false', 'topRatedListing': 'false'}
sale1 = {'itemId': '124264171306', 'title': 'Cruel Celebrant x2, War of the Spark, NM MTG', 'globalId': 'EBAY-US', 'primaryCategory': {'categoryId': '38292', 'categoryName': 'MTG Individual Cards'}, 'galleryURL': 'https://thumbs3.ebaystatic.com/m/mLIR7NRyESaNj9zY6eBuwMA/140.jpg', 'viewItemURL': 'https://www.ebay.com/itm/Cruel-Celebrant-x2-War-Spark-NM-MTG-/124264171306', 'paymentMethod': 'PayPal', 'autoPay': 'true', 'postalCode': '281**', 'location': 'Shelby,NC,USA', 'country': 'US', 'shippingInfo': {'shippingServiceCost': {'_currencyId': 'USD', 'value': '0.0'}, 'shippingType': 'Free', 'shipToLocations': 'Worldwide', 'expeditedShipping': 'false', 'oneDayShippingAvailable': 'false', 'handlingTime': '1'}, 'sellingStatus': {'currentPrice': {'_currencyId': 'USD', 'value': '2.29'}, 'convertedCurrentPrice': {'_currencyId': 'USD', 'value': '2.29'}, 'sellingState': 'EndedWithSales'}, 'listingInfo': {'bestOfferEnabled': 'true', 'buyItNowAvailable': 'false', 'startTime': '2020-07-17T17:25:06.000Z', 'endTime': '2020-08-09T17:58:52.000Z', 'listingType': 'StoreInventory', 'gift': 'false'}, 'returnsAccepted': 'false', 'condition': {'conditionId': '1000', 'conditionDisplayName': 'New'}, 'isMultiVariationListing': 'false', 'topRatedListing': 'false'}


class MatchedPurchase:

def __init__(self, query_result):
self.set_match_percent = 90
self.complete_query = query_result
self.ebay_id = query_result['itemId']
self.ebay_title = query_result['title']
self.set_matches = []
self.card_matches = []
self.multiverse_id = None
self.qty = '1'
self.foil = False
self.language = 'English'

def __dict__(self):
classDict = {
'ebay_id': self.ebay_id,
'ebay_title': self.ebay_title,
'set_matches': self.set_matches,
'name_matches': self.card_matches,
'multiverse_id': self.multiverse_id,
'qty': self.qty,
'foil': self.foil,
'language': self.language,
}
return classDict


mp1 = MatchedPurchase(sale0)
mp2 = MatchedPurchase(sale1)
print('hmmm')

Produces the following result:

Requirements.txt: 

beautifulsoup4==4.9.1
bs4==0.0.1
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
colorama==0.4.3
configparser==5.0.0
crayons==0.3.1
cycler==0.10.0
decorator==4.4.2
ebaysdk==2.2.0
fake-useragent==0.1.11
Flask==1.1.2
Flask-WTF==0.14.3
Fuzzy==1.2.2
fuzzywuzzy==0.18.0
gunicorn==20.0.4
idna==2.10
imageio==2.9.0
imutils==0.5.3
inflect==4.1.0
itsdangerous==1.1.0
Jinja2==2.11.2
kiwisolver==1.2.0
lxml==4.5.2
MarkupSafe==1.1.1
matplotlib==3.3.0
mtgsdk==1.3.1
networkx==2.4
numpy==1.19.1
opencv-python==4.3.0.36
pandas==1.1.0
Pillow==7.2.0
psycopg2-binary==2.8.5
pyparsing==2.4.7
python-dateutil==2.8.1
python-Levenshtein==0.12.0
pytube3==9.6.4
pytz==2020.1
PyWavelets==1.1.1
requests==2.24.0
scikit-image==0.17.2
scipy==1.5.2
seaborn==0.10.1
selenium==3.141.0
six==1.15.0
soupsieve==2.0.1
SQLAlchemy==1.3.18
tifffile==2020.7.24
typing-extensions==3.7.4.2
urllib3==1.25.10
webdriver-manager==3.2.1
Werkzeug==1.0.1
WTForms==2.3.3
0

Ahh, I see. I wasn't able to reproduce it because I didn't add __dict__ attribute and it seems to be the culprit. I filed a bug to our issue tracker about that https://youtrack.jetbrains.com/issue/PY-43955, feel free to vote and comment.

1
Avatar
Permanently deleted user

Thank you so much for your help! This is my first time working with a professional IDE and I'm very happy with PyCharm. Its crazy to think I've deployed systems to customers using basically text editors - this makes everything much more manageable; I was pulling my hair out wondering what could be going on.

0

Please sign in to leave a comment.