Active Path Plugin Error

42 views
Skip to first unread message

Beckett Simmons

unread,
Feb 28, 2015, 10:32:18 AM2/28/15
to leo-e...@googlegroups.com
Hey all,
So getting this error that I can't seem to fix it myself. Hopefully someone here can help me out.

So I checked out the latest leo code from Github. You can see the commit hash in the below log.
Previously, I updated my settings file ~/.leo/myLeoSettings.py by uncommenting the active_path.py plugin.

I then run Leo with this command:  $ python -c "import leo; leo.run()"
I then try to drag and drop a directory into my .leo project (as the plugin recommends) and I end up getting this error.

Leo Log Window
Leo 5.0-final, build 20150225125830, Wed Feb 25 12:58:30 CST 2015
Git repo info: branch = master, commit = 51e89bdbb865
Python 2.7.9, PyQt version 4.8.6
Windows 8 AMD64 (build 6.2.9200) 
reading: C:\Users\bsimmons\leos\bermudahurricane.leo
read outline in 0.08 seconds
hook failed: after-create-leo-frame, <function onCreate at 0x00000000036B4908>, leo.plugins.todo
Traceback (most recent call last):
  File "leo\core\leoPlugins.py", line 357, in callTagHandler
    result = handler(tag,keywords)
  File "leo\plugins\todo.py", line 99, in onCreate
    todoController(c)
  File "leo\plugins\todo.py", line 399, in __init__
    os.chdir(os.path.split(__file__)[0])
WindowsError: [Error 3] The system cannot find the path specified: 'leo\\plugins'

Of course the leo/plugins directory is indeed there, any idea why Windows says it can't be found?

Thanks,
       Beckett

Edward K. Ream

unread,
Feb 28, 2015, 11:26:46 AM2/28/15
to leo-editor
On Sat, Feb 28, 2015 at 8:00 AM, Beckett Simmons <beckett...@hotmail.com> wrote:

Leo Log Window
Leo 5.0-final, build 20150225125830, Wed Feb 25 12:58:30 CST 2015
Git repo info: branch = master, commit = 51e89bdbb865
Python 2.7.9, PyQt version 4.8.6
Windows 8 AMD64 (build 6.2.9200) 
reading: C:\Users\bsimmons\leos\bermudahurricane.leo
read outline in 0.08 seconds
hook failed: after-create-leo-frame, <function onCreate at 0x00000000036B4908>, leo.plugins.todo
Traceback (most recent call last):
  File "leo\core\leoPlugins.py", line 357, in callTagHandler
    result = handler(tag,keywords)
  File "leo\plugins\todo.py", line 99, in onCreate
    todoController(c)
  File "leo\plugins\todo.py", line 399, in __init__
    os.chdir(
​​
os.path.split(__file__)[0])
WindowsError: [Error 3] The system cannot find the path specified: 'leo\\plugins'

Of course the leo/plugins directory is indeed there, any idea why Windows says it can't be found?

​leo/plugins is a path relative the os.curdir.​


​It looks like todo.py needs to compute an absolute path. Clearly,
os.path.split(__file__)[0] is not up to the job.

EKR

Terry Brown

unread,
Feb 28, 2015, 12:26:40 PM2/28/15
to leo-e...@googlegroups.com
On Sat, 28 Feb 2015 10:26:43 -0600
"Edward K. Ream" <edre...@gmail.com> wrote:

> ​It looks like todo.py needs to compute an absolute path. Clearly,
> ​
> os.path.split(__file__)[0] is not up to the job.

Fixed -
http://stackoverflow.com/questions/7116889/python-file-attribute-absolute-or-relative
apparently __file__ may or may not be absolute - must be almost always
absolute, or this would have been reported long ago, but almost always
is only almost :-}

Cheers -Terry

Beckett Simmons

unread,
Feb 28, 2015, 7:25:39 PM2/28/15
to leo-e...@googlegroups.com
Yeah, I was wondering why I would be the first one coming across this bug.

But thanks for fixing that so quickly!
       Beckett

Edward K. Ream

unread,
Mar 2, 2015, 3:26:51 PM3/2/15
to leo-editor
On Sat, Feb 28, 2015 at 11:26 AM, 'Terry Brown' via leo-editor <leo-e...@googlegroups.com> wrote:

Fixed -
http://stackoverflow.com/questions/7116889/python-file-attribute-absolute-or-relative
 
apparently __file__ may or may not be absolute - must be almost always
absolute, or this would have been reported long ago, but almost always
is only almost :-}

​Thanks Terry.  From the SO answer it appears that this mess is the result of not wanting to call getpwd() on every import. Sounds reasonable, but the result is a mess.  Not Pythonic, imo.

EKR
Reply all
Reply to author
Forward
0 new messages