python_webservices_library icon indicating copy to clipboard operation
python_webservices_library copied to clipboard

int() can't convert non-string with explicit base

Open alimjanablikim opened this issue 9 years ago • 6 comments

Exception Type: TypeError Exception Value: int() can't convert non-string with explicit base Exception Location: C:\Python27\lib\site-packages\sugarcrm\sugarmodule.py in _search, line 101

getting this error, any idea?

alimjanablikim avatar May 09 '16 11:05 alimjanablikim

my code: def get_all_accounts(cls): accounts_list = [] accounts = cls.sugarcrm_connection['Accounts'].query() for account in accounts[:3]: accounts_list.append(account['name'])

    return accounts_list

alimjanablikim avatar May 09 '16 11:05 alimjanablikim

What version of SugarCRM are you using? On my system the responses to get_entry_list include a total_count that is in string format, so it's being parsed from the string into an integer for comparison. If something's changed in the latest version of Sugar the library may need some adjustment.

gddc avatar May 09 '16 15:05 gddc

@gddc It can be integer (-1). We are also facing the same issue. Please let us know when you are planning to fix this issue.

habeebperwad avatar May 15 '16 16:05 habeebperwad

I can't seem to prompt my system to return -1 for calls into that function, but I've removed the explicit base in the conversion to an integer in that line. I believe that should resolve this. If you would care to test with the latest code and let me know how you fare.

gddc avatar May 17 '16 16:05 gddc

Hi thanks for your reply, i use sugarcrm6.5 anv v4 api too, after you commit i get this error File "C:\Python27\lib\site-packages\sugarcrm\sugarmodule.py", line 173, in next self._total = result['total'] KeyError: u'total'

i use this module with Django1.9 , my Python version is 2.7.11

alimjanablikim avatar May 18 '16 07:05 alimjanablikim

It would really help to know what the content of result in the line above was in your situation - it seems as though the responses from your system are not in line with the normal expectations - I've never encountered errors at those particular functions. In any event, I've added some defensive code to that area of the retrieval if you'd care to test with the latest.

gddc avatar May 19 '16 16:05 gddc