Git Product home page Git Product logo

flox's Introduction

Release

Depreciated in favor of pyFlowLauncher! Please see: https://github.com/garulf/pyflowlauncher

FLOX

Flox is a Python library to help build Flow Launcher and Wox plugins

Flox adds many useful methods to speed up plugin development

Heavily inspired from the great work done by deanishe at: deanishe/alfred-workflow

Installation

PIP install from pypi

pip install flox-lib

PIP install from github

pip install git+https://github.com/garulf/flox.git

Basic Usage

from flox import Flox

import requests

# have your class inherit from Flox
class YourClass(Flox):

    def query(self, query):
        for _ in range(250):
            self.add_item(
                title=self.args,
                subtitle=str(_)
            )

    def context_menu(self, data):
        self.add_item(
            title=data,
            subtitle=data
        )

if __name__ == "__main__":
    your_class = YourClass()
    your_class.run()

flox's People

Contributors

garulf avatar

Stargazers

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

Watchers

 avatar

flox's Issues

Crashes with FlowPluginException: The input does not contain any JSON tokens when using 0.20.0

I started playing with FlowLauncher today and found your library, and could not understand what's wrong. So after some experiments I found out that it's crashing when using version 0.20.0 and not crashing with any older version (0.19.6 included).

I have an absolutely basic example:

from flox import Flox

# have your class inherit from Flox
class YourClass(Flox):    
    def query(self, query):
        for _ in range(250):
            self.add_item(
                title=self.args,
                subtitle=str(_)
            )

if __name__ == "__main__":
    YourClass()

And Flow Launcher is saying that the response does not contain any JSON tokens:

(don't mind "version 1.0.0", it's dev compiled by me for some tests, based on Flow-Launcher/Flow.Launcher@03983b9)

Flow Launcher version: 1.0.0
OS Version: 22621.2070
IntPtr Length: 8
x64: True

Python Path: C:\Users\ktos\AppData\Local\Programs\Python\Python310\pythonw.exe
Node Path: 
Date: 08/09/2023 18:33:06
Exception:
YourClass Exception: 
Websites: https://github.com/ktos/flowgpt
Author: ktos
Version: 0.1.0
Flow.Launcher.Core.ExternalPlugins.FlowPluginException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
 ---> System.Text.Json.JsonException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
 ---> System.Text.Json.JsonReaderException: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 0 | BytePositionInLine: 0.
   at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
   at System.Text.Json.Utf8JsonReader.Read()
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.JsonSerializer.ContinueDeserialize[TValue](ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack, JsonTypeInfo jsonTypeInfo)
   at System.Text.Json.JsonSerializer.ReadFromStreamAsync[TValue](Stream utf8Json, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
   at Flow.Launcher.Core.Plugin.JsonRPCPlugin.DeserializedResultAsync(Stream output) in E:\proj2\Flow.Launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 95
   at Flow.Launcher.Core.Plugin.JsonRPCPlugin.DeserializedResultAsync(Stream output) in E:\proj2\Flow.Launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 95
   at Flow.Launcher.Core.Plugin.JsonRPCPlugin.QueryAsync(Query query, CancellationToken token) in E:\proj2\Flow.Launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 313
   at Flow.Launcher.Core.Plugin.PluginManager.<>c__DisplayClass22_0.<<QueryForPluginAsync>b__0>d.MoveNext() in E:\proj2\Flow.Launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 194
--- End of stack trace from previous location ---
   at Flow.Launcher.Infrastructure.Stopwatch.DebugAsync(String message, Func`1 action) in E:\proj2\Flow.Launcher\Flow.Launcher.Infrastructure\Stopwatch.cs:line 40
   at Flow.Launcher.Core.Plugin.PluginManager.QueryForPluginAsync(PluginPair pair, Query query, CancellationToken token) in E:\proj2\Flow.Launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 216
   --- End of inner exception stack trace ---
   at Flow.Launcher.Core.Plugin.PluginManager.QueryForPluginAsync(PluginPair pair, Query query, CancellationToken token) in E:\proj2\Flow.Launcher\Flow.Launcher.Core\Plugin\PluginManager.cs:line 216
   at Flow.Launcher.ViewModel.MainViewModel.<>c__DisplayClass139_0.<<QueryResults>g__QueryTask|2>d.MoveNext() in E:\proj2\Flow.Launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 849
--- End of stack trace from previous location ---
   at Flow.Launcher.ViewModel.MainViewModel.QueryResults(Boolean isReQuery) in E:\proj2\Flow.Launcher\Flow.Launcher\ViewModel\MainViewModel.cs:line 850
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Opening file default encoding error

OS:Windows 10
Python Version: 3.11
Flox Version : 0.19.3

When I was developing the plug-in for Flow Launcher, there was an error reading Setting.json

Erro: UnicodeDecodeError: 'xxx' codec can't decode byte 0xae in position 170: illegal multibyte sequence

The system default encoding cannot open utf-8.
flox/init_.py line 213 - 214:
with open(os.path.join(self.plugindir, PLUGIN_MANIFEST), 'r') as f:
return json.load(f)

I need to change my Setting.json to system default encoding ,To solve this problem.

Maybe you can add an encoding parameter to the error location,

Empty JSONRPC Response from FlowLauncher when using the latest Flox version.

Getting this error with FlowLauncher when using the latest version of Flox (doesn't happen with 0.10):

Flow Launcher version: 1.9.3
OS Version: Microsoft Windows NT 10.0.19043.0
IntPtr Length: 8
x64: True

Python Path:
Date: 04/16/2022 22:44:41
Exception:
System.IO.InvalidDataException: Spell Checker|Empty JSONRPC Response
at Flow.Launcher.Core.Plugin.JsonRPCPlugin.ExecuteAsync(ProcessStartInfo startInfo, CancellationToken token) in C:\projects\flow-launcher\Flow.Launcher.Core\Plugin\JsonRPCPlugin.cs:line 308

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.