Skip to content

fix bug when using encoding#4

Merged
ppiorunski merged 1 commit intoperforce:masterfrom
shuaibingn:master
Jun 9, 2022
Merged

fix bug when using encoding#4
ppiorunski merged 1 commit intoperforce:masterfrom
shuaibingn:master

Conversation

@shuaibingn
Copy link
Copy Markdown

when using encoding and logger in P4, this line will raise an exception, because the type of item in flatArgs is bytes, but bytes has no join.

self.logger.info("p4 " + " ".join(flatArgs))

so, we can initialize the logger after encoding

@shuaibingn
Copy link
Copy Markdown
Author

this code will reproduce the problem

import logging

from P4 import P4

logger = logging.getLogger()

p4_config = {
    "port": "p4.com:1666",
    "user": "user",
    "password": "password",
}

p4 = P4(**p4_config)

p4.logger = logger
p4.encoding = "utf-8"

p4.connect()
p4.run_login()
p4.disconnect()

@ppiorunski
Copy link
Copy Markdown
Contributor

Thank you for the PR

@ppiorunski ppiorunski merged commit 45e107c into perforce:master Jun 9, 2022
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.

2 participants