Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

int as argument for Sender's functions doesn't work. #32

Closed
luckydonald opened this issue Jul 2, 2015 · 6 comments
Closed

int as argument for Sender's functions doesn't work. #32

luckydonald opened this issue Jul 2, 2015 · 6 comments

Comments

@luckydonald
Copy link
Owner

int as argument does not work.
Fails concatenating the final command string arg_string = " ".join([u(x) for x in args])

s.history('user_name', 10)
# log/stacktrace shows:
DEBUG:pytg.sender:Parsing history: Argument user_name - <user> (needed)
DEBUG:pytg.sender:Parsing history: Argument 10 - [limit] (needed)
DEBUG:pytg.sender:Skipping missing optional parameter #2 [offset] (type NonNegativeNumber) in function history.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/path/to/pytg/pytg/sender.py", line 548, in command_alias
    return self.execute_function(command_name, *args, **kwargs)
  File "/path/to/pytg/pytg/sender.py", line 252, in execute_function
    result = self._do_command(command_name, new_args, answer_timeout=self.default_answer_timeout, retry_connect=retry_connect, enable_preview=enable_preview, reply_id=reply_id)
  File "/path/to/pytg/pytg/sender.py", line 356, in _do_command
    arg_string = " ".join([u(x) for x in args])
TypeError: sequence item 1: expected str instance, int found
>>> from pytg.sender import Sender ; import logging
>>> s.execute_function('history', 'user_name', 10)
DEBUG:pytg.sender:Parsing history: Argument user_name - <user> (needed)
DEBUG:pytg.sender:Parsing history: Argument 10 - [limit] (needed)
DEBUG:pytg.sender:Skipping missing optional parameter #2 [offset] (type NonNegativeNumber) in function history.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/path/to/pytg/pytg/sender.py", line 252, in execute_function
    result = self._do_command(command_name, new_args, answer_timeout=self.default_answer_timeout, retry_connect=retry_connect, enable_preview=enable_preview, reply_id=reply_id)
  File "/path/to/pytg/pytg/sender.py", line 356, in _do_command
    arg_string = " ".join([u(x) for x in args])
TypeError: sequence item 1: expected str instance, int found```
@luckydonald
Copy link
Owner Author

from #31

@luckydonald luckydonald added the bug label Jul 2, 2015
luckydonald added a commit that referenced this issue Jul 2, 2015
…that as well, so an int becomes a string in requested format. Fixes issue #32, and so closes issue #31
@luckydonald
Copy link
Owner Author

Fixed

@ZeroDivisionError
Copy link

Still broken for python 3. Because python-utils/luckydonaldUtils/encoding.py does not include commit with this bugfix.

@luckydonald luckydonald reopened this Sep 10, 2015
@luckydonald
Copy link
Owner Author

Eargh

luckydonald added a commit to luckydonald/luckydonald-utils that referenced this issue Sep 10, 2015
@luckydonald
Copy link
Owner Author

Please update luckydonald-utils to v0.017 or newer.
v0.017 Package is called 0.17 in pip.

@luckydonald
Copy link
Owner Author

I assume this as fixed and working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants