Google Data API: how to do authentication for desktop applications

I wonder about the best/easiest way to authenticate the user for the Google Data API in a desktop app. I read through the docs and it seems that my options are ClientLogin or OAuth. For ClientLogin, it seems I have to implement the UI for login/password (and related things like saving this somewhere etc.) myself. I really wonder if there is some more support there which may pop up some defau

Google Data API:如何对桌面应用程序进行身份验证

我想知道在桌面应用中验证Google Data API用户的最佳/最简单的方法。 我阅读了文档,看起来我的选项是ClientLogin或OAuth。 对于ClientLogin,我似乎必须自己实现用户界面的登录/密码(以及相关的事情,比如保存在某处等)。 我真的不知道是否有更多的支持,可能会弹出一些默认的登录/密码屏幕,并使用操作系统钥匙串来存储密码等。我想知道为什么这种支持不存在? 这不是标准程序吗? 通过将这个实现留给开发者(当然,

How to send an email with Gmail as provider using Python?

I am trying to send email (Gmail) using python, but I am getting following error. Traceback (most recent call last): File "emailSend.py", line 14, in <module> server.login(username,password) File "/usr/lib/python2.5/smtplib.py", line 554, in login raise SMTPException("SMTP AUTH extension not supported by server.") smtplib.SMTPException: SMTP AUTH extension not supported by server

如何使用Python将邮件作为提供者发送给Gmail?

我正尝试使用python发送电子邮件(Gmail),但我遇到了以下错误。 Traceback (most recent call last): File "emailSend.py", line 14, in <module> server.login(username,password) File "/usr/lib/python2.5/smtplib.py", line 554, in login raise SMTPException("SMTP AUTH extension not supported by server.") smtplib.SMTPException: SMTP AUTH extension not supported by server. Python脚本如下。

Inheriting behaviours for set and frozenset seem to differ

Can someone explain the following behaviour: class derivedset1(frozenset): def __new__(cls,*args): return frozenset.__new__(cls,args) class derivedset2(set): def __new__(cls,*args): return set.__new__(cls,args) a=derivedset1('item1','item2') # WORKS b=derivedset2('item1','item2') # DOESN'T WORK Traceback (most recent call last): File "inheriting-behaviours.py"

继承set和frozenset的行为似乎有所不同

有人可以解释以下行为: class derivedset1(frozenset): def __new__(cls,*args): return frozenset.__new__(cls,args) class derivedset2(set): def __new__(cls,*args): return set.__new__(cls,args) a=derivedset1('item1','item2') # WORKS b=derivedset2('item1','item2') # DOESN'T WORK Traceback (most recent call last): File "inheriting-behaviours.py", line 12, in <modu

Speech processing library in Python for speech to text

嘿,我期待在python中建立一个代码,它会识别我通过micrphone说话并转换为语音,你能给我几个高效的语音处理库,以实现相同的? See pyspeech (python) - Transcribe mp3 files? which talks about http://code.google.com/p/pyspeech/. You may also want to look at http://code.google.com/p/dragonfly/ The dragonfly sample code misses out on a snippet while providing the code example at https://pythonhosted.or

用于语音到文本的Python语音处理库

嘿,我期待在python中建立一个代码,它会识别我通过micrphone说话并转换为语音,你能给我几个高效的语音处理库,以实现相同的? 请参阅pyspeech(python) - 转录mp3文件? 其中讨论了http://code.google.com/p/pyspeech/。 您也可以查看http://code.google.com/p/dragonfly/ 在https://pythonhosted.org/dragonfly/上提供代码示例时,蜻蜓示例代码未在代码片段中显示 from dragonfly.all import Grammar, CompoundRule #

Image loses quality with cv2.warpPerspective

I am working with OpenCV 3.1 and with Python. My problem comes when I try to deskew (fix the tilt of) an image with text. I am using cv2.warpPerspective to make it possible, but the image loses a lot of quality. You can see here the original part of the image: and then, here, the "rotated" image: it is like smoothed. I was using morphological transformation like: kernel = np.

图像失去cv2.warpPerspective的质量

我正在使用OpenCV 3.1和Python。 当我尝试用文本去倾斜(修正倾斜)图像时,我的问题就出现了。 我正在使用cv2.warpPerspective使其成为可能,但图像失去了很多质量。 你可以在这里看到图像的原始部分: 然后在这里,“旋转”的图像: 它就像平滑。 我正在使用形态转换,如: kernel = np.ones((2, 2), np.uint8) blur_image = cv2.erode(tresh, kernel, iterations=1) 和 white_mask2 = cv2.morphologyEx(white_mask2

MongoDB Print Pretty with PyMongo

This question already has an answer here: Pretty printing of output in pymongo 4 answers PyMongo fetches the documents as Python data structures. So you can use pprint with it like this: from pprint import pprint cursor = collection.find({}) for document in cursor: pprint(document)

MongoDB打印漂亮与PyMongo

这个问题在这里已经有了答案: 漂亮的pymongo 4打印输出 PyMongo将文档作为Python数据结构提取。 所以你可以像这样使用pprint : from pprint import pprint cursor = collection.find({}) for document in cursor: pprint(document)

estimation of subpixel values from images in Python

This question already has an answer here: How to get the image pixel at real locations in opencv? 4 answers There are two common methods: bilinear interpolation, bicubic interpolation. These evaluate an intermediate value, based on the values at four or sixteen neighboring pixels, using weighting functions based on the fractional parts of the coordinates. Lookup these expressions.

估计Python中图像的子像素值

这个问题在这里已经有了答案: 如何在opencv的真实位置获取图像像素? 4个答案 有两种常用方法: 双线性插值, 双三次插值。 这些基于四或十六个相邻像素处的值使用基于坐标的小数部分的加权函数评估中间值。 查找这些表达式。 根据我的经验,双线性质量通常就足够了。

Working with truncated images with PIL

I am trying to get the Python 2.7 PIL Library to work with JPEG images that are only available as a stream coming from a HDD image and are not complete. I have set the option: ImageFile.LOAD_TRUNCATED_IMAGES = True And load the stream as far as it is available (or better said: as far as I am 100% sure that this data is still a image, not some other file type). I have tested different things

用PIL处理截断图像

我试图让Python 2.7 PIL Library能够处理JPEG图像,这些图像只能作为来自HDD映像的流使用,并且不完整。 我已经设置了选项: ImageFile.LOAD_TRUNCATED_IMAGES = True 并尽可能加载流(或者更好地说:就我而言,100%确定这些数据仍然是图像,而不是其他文件类型)。 我测试了不同的东西,据我所知(对于JPEG),如果PIL发现0xFFDA (扫描标记开始),PIL只接受它作为有效的JPEG图像。 这是我如何加载数据的简短示例: fro

vims cmd to tee to persistent python 'watchdog' process

I would like to run a command from vim, to spawn a persistent python watchdog process. The normal command is pycco -w somefile.py . I have tried running tee from vim. :!pycco -w | tee % | w % :!pycco -w | tee % | w % runs the python watchdog command but does not return to vim. Reversed, :w tee % | !pycco -w % :w tee % | !pycco -w % generates error e172 only 1 file name allowed A comment

vims cmd开球到持续的python'看门狗'进程

我想从vim运行一个命令来产生持久化的python监视程序进程。 正常的命令是pycco -w somefile.py 。 我曾尝试从vim运行tee。 :!pycco -w | tee % | w % :!pycco -w | tee % | w %运行python watchdog命令但不返回到vim。 相反, :w tee % | !pycco -w % :w tee % | !pycco -w %生成错误e172 only 1 file name allowed 此主题中的评论者提到使用sh -c ">"而不是tee。 (我尝试sh时会产生尾随字符错误)。

Vim automatically removes indentation on Python comments

This question already has an answer here: How to configure vim to not put comments at the beginning of lines while editing python files 8 answers Setting smartindent on makes Vim behave like you describe for me, whereas with nosmartindent (which is what I tend to use) it behaves like you'd prefer it to. Update: From the docs on smartindent : When typing '#' as the first charac

Vim自动删除Python注释中的缩进

这个问题在这里已经有了答案: 如何配置vim不要在编辑python文件时在行的开头放置注释8个答案 设置smartindent使Vim的行为就像你为我描述的一样,而使用nosmartindent (这是我倾向于使用的),它的行为就像你喜欢的那样。 更新:从smartindent文档: 当在新行中输入“#”作为第一个字符时,该行的缩进被删除,'#'被放入第一列。 下一行恢复缩进。 如果你不想要这个,使用这个映射:“:inoremap#X ^ H#”,其