Can't edit files whose names begin with numbers

Bug #237781 reported by WoLpH on 2008-06-05
Affects Status Importance Assigned to Milestone

Bug Description

When doing something like %edit the edit mode automatically tries to look for row which naturally fails since it can't convert the input to an int. The code in already mentions this (line 3273):
# This means that you can't edit files whose names begin with
# numbers this way. Tough.

To avoid this problem I recommend changing the regex from r'\d' to something like r'^\d+(.*\d+)?$' (looking for one or more digits, optionally followed by some other character followed by more digits, with the constraint that it has to start and end with this pattern. In my simple tests this hack seems to work but I'm not sure I've covered all the possible cases.

Another option might be changing the if so the args.endswith('.py'): comes before the regular expression.

Brian Granger (ellisonbg) wrote :

This bug should be easy to fix, we just need someone to carefully look at the regexp used in magic_edit. Also, we need to add tests to make sure that all the cases of parsing are handled correctly.

Changed in ipython:
importance: Undecided → Low
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers