avanov/Plim — pull request #32 by dongweiming (2014-05-26 09:31:09+00:00)
Title: Fix plimc error when use custom_module

I have a custom module want using extensions API

```
$cat a.py
import re
from plim import preprocessor_factory
from plim.util import joined

PARSE_DISPLAY_COMMENT_RE = re.compile('/!.*')

def parse_can_display_comment(indent_level, current_line, matched, source, syntax):
return joined(['']), indent_level, '', source

CUSTOM_PARSERS = [
(PARSE_DISPLAY_COMMENT_RE, parse_can_display_comment)
]

custom_preprocessor = preprocessor_factory(custom_parsers=CUSTOM_PARSERS, syntax='mako')
```

But when i use plimc, It raise this:

```
$plimc -p a:custom_preprocessor a.plim
Traceback (most recent call last):
File "/Users/dongweiming/test_plim/venv/bin/plimc", line 9, in
load_entry_point('Plim==0.9.9', 'console_scripts', 'plimc')()
File "build/bdist.macosx-10.9-intel/egg/plim/console.py", line 45, in plimc
File "/Users/dongweiming/test_plim/venv/lib/python2.7/site-packages/pkg_resources.py", line 2048, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
ImportError: No module named a
```
when i use ipython it's works:

```
$ipython
In [1]: from pkg_resources import EntryPoint
In [2]: EntryPoint.parse('x={}'.format('a:custom_preprocessor')).load(False)
Out[2]:
In [3]: import sys
In [4]: '' in sys.path
Out[4]: True
```
And use defualt preprocessor(plim:preprocessor) is also works.

Because the default can import:

```
$python
>>> from plim import preprocessor
```

I found that after commissioning because sys.path which perform EntryPoint call has no current directory.

I add this line in `venv/lib/python2.7/site-packages/pkg_resources.py` L 2048
```
print '' in sys.path
```
It's False