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

[zos-files] download_dsn fails to write contents to disk #179

Closed
t1m0thyj opened this issue May 31, 2023 · 4 comments · Fixed by #248
Closed

[zos-files] download_dsn fails to write contents to disk #179

t1m0thyj opened this issue May 31, 2023 · 4 comments · Fixed by #248
Labels

Comments

@t1m0thyj
Copy link
Member

Traceback (most recent call last):
  File "C:\Users\user\Projects\zowe\zowe-client-python-sdk\test.py", line 14, in <module>
    files_api.download_dsn(dsname, "test-download.txt")
  File "c:\users\user\projects\zowe\zowe-client-python-sdk\src\zos_files\zowe\zos_files_for_zowe_sdk\files.py", line 405, in download_dsn
    shutil.copyfileobj(raw_response, f)
  File "C:\Python310\lib\shutil.py", line 198, in copyfileobj
    fdst_write(buf)
TypeError: write() argument must be str, not bytes
@t1m0thyj t1m0thyj added the bug Something isn't working label May 31, 2023
@github-actions
Copy link

Thank you for creating a bug report.
We will investigate the bug and evaluate its impact on the product.
If you haven't already, please ensure you have provided steps to reproduce the bug and as much context as possible.

@Aman123lug
Copy link
Contributor

Aman123lug commented Aug 8, 2023

I want to work on this issue. I want to contribute in a medium-level problem can I work on this?

@t1m0thyj
Copy link
Member Author

t1m0thyj commented Aug 9, 2023

@Aman123lug Feel free to work on this issue, although you'll need a z/OSMF environment to be able to reproduce the issue and test a fix 🙂

To gain access to a mainframe running z/OSMF, you could sign up for the OMP Cobol Programming Course or request a 3-day trial from IBM here.

@t1m0thyj
Copy link
Member Author

To work around this issue, the file can be downloaded to a string and then saved to a file:

dsn_contents = files.get_dsn_content(dsname)
with open(dsname.split(".")[-1] + ".txt", 'w') as f:
    f.write(dsn_contents["response"])

@t1m0thyj t1m0thyj moved this to High Priority in Zowe CLI Squad Dec 26, 2023
@t1m0thyj t1m0thyj linked a pull request Jan 9, 2024 that will close this issue
4 tasks
@github-project-automation github-project-automation bot moved this from High Priority to Closed in Zowe CLI Squad Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants