A problem from a Vim user

M

manuhack

When I use raw_input('Please type something.\n') in the python 2.4
command line windows, it doesn't have any problem. However, when I run
the same command in vim 7 as :py raw_input('Please type something.\n'),
there is an EOFError: EOF when reading a line. Is there a way to use
that command within vim without raising errors?

Thanks a lot.
 
L

Luis Armendariz

manuhack said:
When I use raw_input('Please type something.\n') in the python 2.4
command line windows, it doesn't have any problem. However, when I run
the same command in vim 7 as :py raw_input('Please type something.\n'),
there is an EOFError: EOF when reading a line. Is there a way to use
that command within vim without raising errors?

Thanks a lot.

You should read :help python-input

On my version (Vim 7.0.17), it says that input() and raw_input() are
not yet supported.

So, submit a patch to the vim folks!

-Luis
 
B

BartlebyScrivener

manuhack said:
However, when I run
the same command in vim 7 as :py raw_input('Please type something.\n'),
there is an EOFError: EOF when reading a line. Is there a way to use
that command within vim without raising errors?

I thought you might get more help here than in comp.editors ;)

Same thing happens if you put it in rawinput.py file and use :pyfile.

rd
 
D

Dasn

When I use raw_input('Please type something.\n') in the python 2.4
command line windows, it doesn't have any problem. However, when I run
the same command in vim 7 as :py raw_input('Please type something.\n'),
there is an EOFError: EOF when reading a line. Is there a way to use
that command within vim without raising errors?

You could call vim functions indirectly:
:py << EOF
import vim
vim.command('let vim_str=input("Please type something.\n")')
py_str = vim.eval('vim_str')
# now you can do something with your 'py_str'
....
EOF

HTH
 
D

Dasn

vim.command('let vim_str=input("Please type something.\n")')
py_str = vim.eval('vim_str')

py_str = vim.eval('input("Please type something.\n")')

may be better.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top