Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Query.start_position has no setter #83

Closed
astonm opened this issue Oct 11, 2016 · 1 comment
Closed

Query.start_position has no setter #83

astonm opened this issue Oct 11, 2016 · 1 comment

Comments

@astonm
Copy link
Contributor

astonm commented Oct 11, 2016

If I interrupt my codemod session (with ctrl-C) and attempt to restart it, I get the expected prompt

Resume where you left off, at ./my/files/code.py:10 (y/n)?

But when I choose y I get the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/codemod", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/codemod/base.py", line 1004, in main
    run_interactive(**options)
  File "/usr/local/lib/python2.7/site-packages/codemod/base.py", line 130, in run_interactive
    query.start_position = bookmark
AttributeError: can't set attribute

Looking at codemod.py there's a start_position = property(get_start_position), but no setter is specified. I can't find record of a setter having ever been there in this repo, but I know this feature used to work for me in some past version of codemod, so something must have changed. This may be an issue across Python versions (my /usr/bin/env python2 is 2.7.12).

If indeed some code is missing, I'm happy to submit a PR to add (re-add?) a setter for Query.start_position, and also one for Query.end_position while I'm at it.

@modocache
Copy link
Contributor

Yes, please do send a pull request! This sounds like a legitimate bug. I haven't seen it, since I almost never use the "resume" feature 😇

astonm added a commit to astonm/codemod that referenced this issue Oct 13, 2016
Allows you to resume a codemod session after exiting with Ctrl-C.
Fixes facebookarchive#83.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants