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

Local .thrift file don't get picked up on Windows. #269

Open
ErKatz opened this issue Dec 6, 2016 · 1 comment
Open

Local .thrift file don't get picked up on Windows. #269

ErKatz opened this issue Dec 6, 2016 · 1 comment

Comments

@ErKatz
Copy link
Contributor

ErKatz commented Dec 6, 2016

On windows when the path start with the "file://" scheme, I get the following error:
(path is 'file://C:\Users\MrT\UserSegmentation\lib\site-packages\happybase\Hbase.thrift')

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Erez.Katz\UserSegmentation\Lib\site-packages\happybase_init_.py", line 10, in
'Hbase_thrift')
File "C:\Users\Erez.Katz\UserSegmentation\Lib\site-packages\thriftpy\parser_init_.py", line 30, in load
include_dir=include_dir)
File "C:\Users\Erez.Katz\UserSegmentation\Lib\site-packages\thriftpy\parser\parser.py", line 496, in parse
url_scheme))
thriftpy.parser.exc.ThriftParserError: ThriftPy does not support generating module with path in protocol 'file'

workaround that I added in my environment in thriftpy\parser\parser.py", around starting at line 540

url_scheme = urlparse(path).scheme
if url_scheme == 'file':
    with open(urlparse(path).netloc) as fh:
        data = fh.read()
elif url_scheme == '':
    with open(path) as fh:
        data = fh.read()
elif url_scheme in ('http', 'https'):
    data = urlopen(path).read()
else:
    raise ThriftParserError('ThriftPy does not support generating module '
                            'with path in protocol \'{}\''.format(
                                url_scheme))
@ErKatz
Copy link
Contributor Author

ErKatz commented Dec 6, 2016

this also impacts
python-happybase/happybase#148

ErKatz added a commit to ErKatz/thriftpy that referenced this issue Dec 6, 2016
Full explanation is here  :  Thriftpy#269
and here : python-happybase/happybase#148
@ErKatz ErKatz mentioned this issue Dec 6, 2016
ErKatz added a commit to ErKatz/happybase that referenced this issue Dec 6, 2016
On non-Windows systems: things stay as they are
On windows system: it would pass the path to the thrift file with "file://" scheme.
If ThriftPY is fixed to handle the 'file' scheme - things would work on windows.
Until then, things will stay broken, as they are now.

This is further discussed here: python-happybase#148
and here:  Thriftpy/thriftpy#269

NOTE: I created a corresponding fork and pull request on thrifypy as well:
 Thriftpy/thriftpy#270
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

1 participant