Comments (10)
Many thanks for your reply.
Indeed, this issues was caused by the python version incompatibility.
Based on your helpful suggestion, I managed to solve this problem by setting the workflow interpreter to my python2 env.
from linggle_alfred.
I have python2 in build and requests already
from linggle_alfred.
I implement this plugin in Python 3. It seems that the program exits when you type the commands. Would you please just upgrade your Python and try again?
from linggle_alfred.
I believe I have installed python3 also, it still did not work as expect.
Another thing is about I query the json directly bymy own python program, it also do not work well either
Is there any other thing that I need to consider about?
from linggle_alfred.
I believe the two outputs are consistent with the behavior when you type the two words in Linggle website. It seems that feeding a single word to Linggle receives no results so you may need to query some more complex phrases. BTW, when you input a single word like that, can your Alfred show a "Visit Linggle" bar? If it doesn't, I suspect that there must be something wrong with Alfred itself as the Python script runs as expected...
from linggle_alfred.
Hi, I also meet the same issue. Please can I ask if you have found any solution for this problem.
from linggle_alfred.
Hi, I also meet the same issue. Please can I ask if you have found any solution for this problem.
Have you tried the newest commit version?
from linggle_alfred.
Thanks for your reply.
I'm using the latest version (v1.2).
My Alfred version is 4.3.4 [1229].
My python version is 3.8.4 with the requests version of 2.25.1.
Also, I attach the screenshots for the issue and my config.
from linggle_alfred.
Thanks for your reply.
I'm using the latest version (v1.2).
My Alfred version is 4.3.4 [1229].
My python version is 3.8.4 with the requests version of 2.25.1.
Also, I attach the screenshots for the issue and my config.
Thanks for your detailed information! From your screenshot I guess that the python script you run exits abnormally.
I find that I have made a mistake in my reply to 0dd. The Alfred workflow Python framework only works for Python 2. Therefore, you have to make sure in your environment python
links to Python 2.
You can manually test the core functionality using the following snippet:
import sys
import json
import time
import requests
if __name__ == '__main__':
s = requests.Session()
query = 'apple'
query_load = requests.utils.quote(query)
answer = s.get('https://linggle.com/api/ngram/{}'.format(query_load)).json()
if len(answer['ngrams']) == 0:
print('No results!')
else:
total = 0
for item in answer['ngrams']:
total += item[1]
for item in answer['ngrams'][:20]:
phrase = item[0]
subtitle = '{:.2f}% | {}'.format(float(item[1]) * 100 / total, item[1])
print(query, subtitle)
which should give output like
('apple', '100.00% | 6878789')
from linggle_alfred.
Many thanks for your reply.
Indeed, this issues was caused by the python version incompatibility.
Based on your helpful suggestion, I managed to solve this problem by setting the workflow interpreter to my python2 env.
Happy to see you have resolved the problem!
from linggle_alfred.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linggle_alfred.