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

Fix synchronous translation code sample error. #148

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

Conversation

k-in
Copy link

@k-in k-in commented Dec 18, 2024

This pull request includes changes to the sample_single_document_translation function in the articles/ai-services/translator/document-translation/quickstarts/includes/sdk/python.md file. The changes improve the handling of file paths and the saving of the translated document.

Improvements to file handling:

  • Corrected the method used to obtain the file name from the file path by changing os.path.path.basename to os.path.basename.
  • Changed the file opening mode from "r" (read) to "rb" (read binary) to correctly read the contents of the document.

Enhancements to translation response handling:

  • Modified the code to save the translated document to a file instead of decoding and printing the response stream. This includes writing the response stream to a new file named translated-document.docx.Synchronous translation code sample for python is run in error. Propose to fix those errors.

Synchronous translation code sample for python is run in error. Propose to fix those errors.
Copy link
Contributor

@k-in : Thanks for your contribution! The author(s) have been notified to review your proposed change.

Copy link
Contributor

Learn Build status updates of commit da0171b:

✅ Validation status: passed

File Status Preview URL Details
articles/ai-services/translator/document-translation/quickstarts/includes/sdk/python.md ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

@v-dirichards
Copy link
Contributor

@laujan

Can you review the proposed changes?

Important: When the changes are ready for publication, adding a #sign-off comment is the best way to signal that the PR is ready for the review team to merge.

#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

@v-dirichards v-dirichards reopened this Dec 18, 2024
@prmerger-automator prmerger-automator bot added aq-pr-triaged C+L Pull Request Review Team label and removed qualifies-for-auto-merge labels Dec 18, 2024
Copy link
Contributor

Learn Build status updates of commit da0171b:

✅ Validation status: passed

File Status Preview URL Details
articles/ai-services/translator/document-translation/quickstarts/includes/sdk/python.md ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

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

Successfully merging this pull request may close these issues.

3 participants