douban / linguist

Language Savant, Python clone of github/linguist.
Other
154 stars 37 forks source link

when running the command "python run.py" in tests folder got an error as described in detail below: #9

Closed arnagaram closed 10 years ago

arnagaram commented 10 years ago

When Installed 'linguist' package using 'pip' including its dependencies successfully and tried to run, got the following error. This was the same error when the project was cloned and then "run.py" file was run from "tests" folder as suggested.

$ pylinguist setup.py
Traceback (most recent call last):
  File "/usr/local/bin/pylinguist", line 5, in <module>
    from linguist.libs.repository import Repository
  File "/usr/local/lib/python2.7/dist-packages/linguist/libs/repository.py", line 8, in <module>
    from file_blob import FileBlob
  File "/usr/local/lib/python2.7/dist-packages/linguist/libs/file_blob.py", line 4, in <module>
    from blob_helper import BlobHelper
  File "/usr/local/lib/python2.7/dist-packages/linguist/libs/blob_helper.py", line 14, in <module>
    from language import Language
  File "/usr/local/lib/python2.7/dist-packages/linguist/libs/language.py", line 349, in <module>
    popular=name in popular))
  File "/usr/local/lib/python2.7/dist-packages/linguist/libs/language.py", line 60, in create
    language = cls(attributes)
  File "/usr/local/lib/python2.7/dist-packages/linguist/libs/language.py", line 112, in __init__
    raise TypeError('%s is missing lexer' % self.name)
TypeError: Agda is missing lexer

when running the file in test folder:

$ python run.py

Traceback (most recent call last):
  File "run.py", line 29, in <module>
    main(defaultTest='suite')
  File "/usr/lib/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/usr/lib/python2.7/unittest/main.py", line 149, in parseArgs
    self.createTests()
  File "/usr/lib/python2.7/unittest/main.py", line 158, in createTests
    self.module)
  File "/usr/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python2.7/unittest/loader.py", line 115, in loadTestsFromName
    test = obj()
  File "run.py", line 22, in suite
    module = __import__(module_name, fromlist=[module_name])
  File "/home/aditya/MastersThesis/linguist/tests/test_repository.py", line 5, in <module>
    from libs.repository import Repository
  File "/home/aditya/MastersThesis/linguist/linguist/libs/repository.py", line 8, in <module>
    from file_blob import FileBlob
  File "/home/aditya/MastersThesis/linguist/linguist/libs/file_blob.py", line 4, in <module>
    from blob_helper import BlobHelper
  File "/home/aditya/MastersThesis/linguist/linguist/libs/blob_helper.py", line 14, in <module>
    from language import Language
  File "/home/aditya/MastersThesis/linguist/linguist/libs/language.py", line 349, in <module>
    popular=name in popular))
  File "/home/aditya/MastersThesis/linguist/linguist/libs/language.py", line 60, in create
    language = cls(attributes)
  File "/home/aditya/MastersThesis/linguist/linguist/libs/language.py", line 112, in __init__
    raise TypeError('%s is missing lexer' % self.name)
TypeError: Agda is missing lexer

So What was causing such an error as mentioned above and how to resolve it?

                            Thanks,

Regards, Aditya Reddy

liluo commented 10 years ago

Try this:

git clone https://github.com/liluo/linguist.git
cd linguist
git checkout dev
(sudo) python setup.py install

pylinguist setup.py
cd tests
python run.py
arnagaram commented 10 years ago

@liluo

Thanks for a quick reply. The solution did not work either. Got the same error as before when executing 'pylinguist' or run.py. Below the screen shots taken during the installation are attached so that it would be easy to see where its going wrong if any.

                       Thanks,

Regards, Aditya Reddy.

installthroughdev installthroughdev2

liluo commented 10 years ago

@anagaram

Update https://github.com/liluo/linguist/commit/10c573a928c1d41ce014188987d41b69944a0ff9

Test worked on new VPS, pls retry:

git clone https://github.com/liluo/linguist.git
cd linguist
git checkout dev
(sudo) python setup.py install

pylinguist setup.py
cd tests
python run.py
arnagaram commented 10 years ago

@liluo

After the update its working fine now.

Thanks,

Regards, Aditya Reddy

liluo commented 10 years ago

Release v0.1.1, pip install linguist==0.1.1 it's working~

arnagaram commented 10 years ago

@liluo Ho nice. But One thing is to be realized is that:

If Pygments is already installed or due to missing dependency of 'pygments' its automatically installed through the command :

pip  install linguist=0.1.1 

then it does not work.

But the procedure through python setup.py install it only installs required parts of required Pygments and it works without error

So you can look in to that aspect of issue.