我正在使用Ubuntu 14.04.我有以下代码:
import Image
import pytesseract
im = Image.open('test.png')
print pytesseract.image_to_string(im)
Run Code Online (Sandbox Code Playgroud)
但我一直收到以下错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 540, in runfile
execfile(filename, namespace)
File "/home/chaitanya/pythonapp/localcopy.py", line 4, in <module>
print pytesseract.image_to_string(im)
File "/usr/local/lib/python2.7/dist-packages/pytesseract/pytesseract.py", line 142, in image_to_string
config=config)
File "/usr/local/lib/python2.7/dist-packages/pytesseract/pytesseract.py", line 75, in run_tesseract
stderr=subprocess.PIPE)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Run Code Online (Sandbox Code Playgroud)
python程序和图像都在同一个位置.可能是什么问题?
我正在尝试使用 keyup 功能禁用文本框。我有一个TextArea和一个Text Box。现在我在退格键上使用 keyup 操作,就像如果文本区域内的内容长度为 3 一样,它应该禁用文本框。我还有一条警告消息,当文本区域中的内容长度为 3 时,该消息会弹出。代码适用于弹出窗口,但不适用于文本框。我缺少什么?请帮忙。这是我的代码:
$('#comment').keyup(function() {
if (event.which == 8) {
var txt = $('#comment').val().length;
if(txt == 3)
{
alert("backspace");
$("#text1").attr("diasbled", "diasbled");
}
}
});
Run Code Online (Sandbox Code Playgroud)
这是用于此目的的JSfiddle 。
我是rails的新手,我想知道如果有办法改变路线的名称.我会在一分钟内解释这句话.我有一个名为users_controller的控制器,下面是我在控制器中的代码:
def create
if @user.save
redirect_to @user
end
Run Code Online (Sandbox Code Playgroud)
我的routes.rb文件如下:
resources :users
get '/users/:id', to: 'users#show'
Run Code Online (Sandbox Code Playgroud)
现在假设我有一个表格并且我正确地填写它然后我将被重定向到localhost:3000/users/id(id = some value)我做的.现在我想要这个URL localhost:3000/registered.那就是当我点击提交按钮时,如果一切正确,我想看到的URL localhost:3000/registered将我带到我的show动作或者就像是localhost:3000/users/id(id = some value).我不希望ID可见.
为此,我试过get 'registered', to: 'users#show'但仍然看到相同的URL localhost:3000/users/id(id = some value).请告诉我怎么做.
这是我的节目动作
def show
@user = User.find(params[:id])
end
Run Code Online (Sandbox Code Playgroud)
我尝试了另一种方法,将另一个动作放入同一个控制器中.我在users_controller中执行了索引操作并执行了然后我得到了一个No方法错误
我想在引导模态中修复一个元素,position: fixed但是在滚动时会随模态一起移动。我希望它即使在滚动模态后也能保持在它的位置。
这是JSFiddle。在这里,您将看到Patate文本具有position: fixedcss属性,但是如果模式很大,它将随其一起移动。我如何才能将此文本固定在其位置,以便即使滚动模式也可以将其保持在其位置。
我没有运气。请帮忙。谢谢。
jquery ×2
css ×1
css-position ×1
html ×1
javascript ×1
python ×1
python-2.7 ×1
routes ×1
ubuntu-14.04 ×1