Open andf-crl opened 2 years ago
I think a simple fix would be to replace string.strip
with str.strip()
and don't bother with the map
function.
for rec in reader:
writer.writerow(rec.strip())
Thanks @ianjevans I'll test out this change tomorrow.
@ianjevans I get the following similar, but different, suggestion from 2to3
:
$ 2to3 fix-example.py
...
--- fix-example.py (original)
+++ fix-example.py (refactored)
...
- writer.writerow(map(string.strip, rec))
+ writer.writerow(list(map(string.strip, rec)))
Running your suggestion through 2to3
results in a pass!
However, we'd need an Oracle instance, or a sample .lst
file from one, to actually test this and verify that output is as expected with either of these suggested changes, or to see if there is a difference between them.
We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!
Describe the problem
The
fix-example.py
script provided by engineering to DOCs team errors when run bypython3
, aspython2
'sstrip
method has been deprecated ever since. This report came through to DOCS from the TSE org, having been reported by a client you've heard of who tried to run this script and received an error.Please take a moment to update this script, sent to DOCS in 2019, for
python3
as you can. Thank you!To Reproduce
Follow migration process as described on doc, noting failure in step 4 when run with
python3
instead ofpython2
. Note also that doc specifies using python3. See DOC - 5461 for TSE report of error. See original v19.1 version of this page to see that original invocation specifiedpython2
. It seems somewhere along the way, DOCS updated the invocation step to python3 without testing that the script worked inpython3
. Today we have learned that it does not.Expected behavior Modern machines running modern python are able to migrate from Oracle to CRDB successfully.
Additional context Original python script was born in 2019, released as part of this doc alongside CRDB v19.1. I spoke with @drewdeally who provided some context on the history of this script, and advised that we update it for python3. Thanks for the assist!
Jira issue: CRDB-18933