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

Fixed exception on joining non-string element in run args #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TaylorSmallwoodCDPR
Copy link

If a non-string argument is passed to run (like an int changelist number), the join will cause an exception to be thrown (when a logger has been set--if no logger is set, the command will succeed as the rest of the source is able to handle non-string arguments)

Repro:

import logging
from P4 import P4

logging.basicConfig(level="DEBUG")
logger = logging.getLogger()

p4 = P4()
p4.logger = logger
p4.encoding = "utf-8" # Optional

changelist = 123456

p4.connect()
p4.run_describe(changelist)
p4.disconnect()

Result:

  File "C:\Users\XXXXXXXX\AppData\Local\Programs\Python\Python312\Lib\site-packages\P4.py", line 500, in <lambda>
    return lambda *args, **kargs: self.run(cmd, *args, **kargs)
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XXXXXXXX\AppData\Local\Programs\Python\Python312\Lib\site-packages\P4.py", line 598, in run
    self.logger.info("p4 " + " ".join(flatArgs))
                             ^^^^^^^^^^^^^^^^^^
TypeError: sequence item 1: expected str instance, int found

If a non-string argument is passed to run (like an `int` changelist number), the join will cause an exception to be thrown (when a logger has been set--if no logger is set, the command will succeed as the rest of the source is able to handle non-string arguments)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant