Giter Site home page Giter Site logo

atdtool's Introduction

atdtool's People

Contributors

lpenz avatar mattiaslundberg avatar sideshowcoder avatar unhammer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atdtool's Issues

OS X Installation issue

Hello,

I'm attempting to install this on OS X.

When I type "pip3 search atdtool", I get:
atdtool - After the Deadline command-line tool

When I type "pip3 install atdtool", I get:
Collecting atdtool
Could not find a version that satisfies the requirement atdtool (from versions: )
No matching distribution found for atdtool

Any ideas?

Thanks.

P.S. Below is a more detailed output with -vvv:

pip3 -vvv install atdtool
Collecting atdtool
1 location(s) to search for versions of atdtool:

  • https://pypi.python.org/simple/atdtool/
    Getting page https://pypi.python.org/simple/atdtool/
    Looking up "https://pypi.python.org/simple/atdtool/" in the cache
    Current age based on date: 228
    Freshness lifetime from max-age: 600
    Freshness lifetime from request max-age: 600
    The response is "fresh", returning cached response
    600 > 228
    Analyzing links from page https://pypi.python.org/simple/atdtool/
    Could not find a version that satisfies the requirement atdtool (from versions: )
    Cleaning up...
    No matching distribution found for atdtool
    Exception information:
    Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/commands/install.py", line 299, in run
    requirement_set.prepare_files(finder)
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/req/req_set.py", line 360, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/req/req_set.py", line 512, in _prepare_file
    finder, self.upgrade, require_hashes)
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/req/req_install.py", line 273, in populate_link
    self.link = finder.find_requirement(self, upgrade)
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/index.py", line 489, in find_requirement
    'No matching distribution found for %s' % req
    pip.exceptions.DistributionNotFound: No matching distribution found for atdtool

EncodingError with Diacritical Marks

On Windows 7 and OSX when I use atdtool in gVim as the makeprg I get the
following error with the text "my resume".

test.txt|19 col 1| Diacritical Marks "my resume"
|| Traceback (most recent call last):
||   File "C:\bin\atdtool", line 227, in <module>
||     main()
||   File "C:\bin\atdtool", line 220, in main
||     showerrs(filename, fd, errs)
||   File "C:\bin\atdtool", line 175, in showerrs
||     print('  suggestions: %s' % ', '.join(e.suggestions))
|| UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 19: ordinal not in range(128)

Atdtool is trying to tell me to use "Diacritical Marks" and make convert
resume to résumé

Solutions with Code Change

Looking at this stack overflow answer I found a snippet that fixes the problem. The answerer to the question also explained that this snipped isn't Python 3 compatible and after a little more searching I found it's pretty common place but also consider a hack that can mess things up.

import sys
reload(sys)
sys.setdefaultencoding("utf-8")

I also found this that also works but might be less hacky

#!/usr/bin/python -S
import sys 
sys.setdefualtencoding("utf-8")
import site

Also here is a work around if you just want to es not és you can replace this line:

 print('  suggestions: %s' % ', '.join(e.suggestions))

with this:

 print repr('  suggestions: %s' % ', '.join(e.suggestions))

Solution Without Code Change

The most accepted solution is to creating an environmental variable named PYTHONIOENCODING and setting it equal to 'utf-8'.

environmental variables mac osx
environmental variables windows

Conclusion

After finding the environmental variable solution I don't think the code needs to be changed, but this issue can help people that might have the same problem in the future.

Wrong addresses in the reports

On this sample text:
_ _ _ _ englich _ _ writted _ _

atdtool reports:
$ atdtool /tmp/english-sample.txt
/tmp/english-sample.txt:1:8: Spelling "englich"
suggestions: english, English, enrich, Anglice
/tmp/english-sample.txt:2:1: (?) Spelling "englich"
suggestions: written, writhed, witted, gritted

The first report says that is in column 8 but it is on the number 9, so 1:9
The second one says that is the first column of the second line, but we still on the first line, and in column 21, so 1:21

This makes atdtool uncompatible with other external tools, like the atdtool checker in the vim plugin "syntastic"

Not Parsing XML

I do not know if I didn't install the package correctly but, when I run it, the XML is not parsed and there are traceback errors. This was when it was run on the file "hellop world"

<results>
  <error>
    <string>hellop</string>
    <description>Spelling</description>
    <precontext></precontext>
    <suggestions>
        <option>hello</option>
    </suggestions>
    <type>spelling</type>

  </error>
</results>
Traceback (most recent call last):
  File "/usr/local/bin/atdtool", line 85, in <module>
    main()
  File "/usr/local/bin/atdtool", line 75, in main
    errs = atdtool.checkDocument(cfg, fd)
  File "/usr/local/lib/python2.7/dist-packages/atdtool/__init__.py", line 47, in checkDocument
    et = ElementTree.fromstring(response.read())
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1301, in XML
    return parser.close()
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1654, in close
    self._raiseerror(v)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1506, in _raiseerror
    raise err
xml.etree.ElementTree.ParseError: no element found: line 1, column 0

Cheers!

Reused variables that does wrong reports

Hi,

I have found a small bug which should be caused probably by recyclating variables (not cleanup them in each loop, not using them as local, etc...)

In a sample text file that looks like this:
_ _ _ _ englich _ _ writted _ _

You get this report by atdtool:
$ atdtool /tmp/english-sample.txt
/tmp/english-sample.txt:1:8: Spelling "englich"
suggestions: english, English, enrich, Anglice
/tmp/english-sample.txt:2:1: (?) Spelling "englich"
suggestions: written, writhed, witted, gritted

Notice that "Spelling englich" is referenced 2 times but only used one time, the second report is about a different word, not "englich"

Question: Installation on Windows.

My goal was to be able to use atdtool from cmd like this atdtool [filename] were [filename] is a file to run atdtool on. I am able to do this by running the following batch script that is in my PATH.

@echo off
python C:\atdtool\atdtool %1

I was wondering if there is different preferred method for doing this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.