Giter Club home page Giter Club logo

Comments (8)

deanishe avatar deanishe commented on July 28, 2024

No idea. You're using a very old version of Alfred-Workflow.

Please add the latest version of Alfred-Workflow to your workflow and ask again if the problem persists.

from alfred-workflow.

deanishe avatar deanishe commented on July 28, 2024

I was playing with Pandoctor today and had the same problem.

The problem is because you're using web.request() instead of web.get() and didn't set allow_redirects to True (which is the default with web.get(), but not web.request()).

There's no reason to use web.request() directly (the method argument is actually ignored due to Python's silly built-in URL libraries). web.get() has more sensible defaults.

It would probably be much more sensible to include the list of supported formats in your workflow, or at least store them as a JSON file at a URL you control. Relying on parsing 3rd-party HTML when you don't really have to is introducing a potentially large problem into your code.

from alfred-workflow.

fractaledmind avatar fractaledmind commented on July 28, 2024

It would probably be much more sensible to include the list of supported formats in your workflow, or at least store them as a JSON file at a URL you control. Relying on parsing 3rd-party HTML when you don't really have to is introducing a potentially large problem into your code.

The reason I originally went to the website README was that it was always the most up to date, given any potential updates to Pandoc. I didn't want to be responsible for keeping the workflow up-to-date if some format name changes or a new format is added. So, I will try the web.get() solution first, but if that proves flakey, I will hard code and manually update.

Thanks for the catch.

from alfred-workflow.

deanishe avatar deanishe commented on July 28, 2024

Then write a cron job on your own machine that parses the README, generates a JSON file and uploads it (if the parsing succeeds).

Grabbing the latest list of supported formats is not necessarily the best idea, anyway, as there's no guarantee the user has the latest version of Pandoc installed.

Is there no way to get a list of supported formats from the pandoc executable?

from alfred-workflow.

fractaledmind avatar fractaledmind commented on July 28, 2024

The reason I go to the website is that it contains both the CLI-used name and a longer description (e.g. "native (native Haskell), json (JSON version of native AST), markdown (pandoc’s extended markdown), markdown_strict (original unextended markdown)")

I use the descriptions in the UI.

from alfred-workflow.

deanishe avatar deanishe commented on July 28, 2024

Then how about combining the two? A list of all possible formats in a JSON file filtered by the formats supported by the installed version of Pandoc.

The main thrust is, people don't consider HTML to be data and don't think twice about changing it. If you keep the HTML parsing at your end only, instead of breaking everyone's workflow, you'll only break your script.

Fundamentally, you're unnecessarily making your workflow dependent on a webpage you have zero control over, and even when the HTML parsing works, you might still thereby break the workflow because it's pulled in formats that the installed pandoc doesn't actually support.

from alfred-workflow.

deanishe avatar deanishe commented on July 28, 2024

@smargh I've just seen the corresponding issue in the pandoctor repo.

I'd appreciate it if, in future, you'd "page" me from the workflow issue rather than opening an AW issue, or at least reference the source issue when posting one here. There's a lot more context in there.

It's definitely a problem that web.py returns None if a redirect fails, but I'd never have known that was the underlying issue if I hadn't decided to use pandoctor myself.

from alfred-workflow.

fractaledmind avatar fractaledmind commented on July 28, 2024

Good point. I will reference you from the Pandoctor (or whatever the next workflow is where something comes up). Sorry for double posting.

from alfred-workflow.

Related Issues (20)

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.