> Following vim's python help,
>
>
> *"To pass arguments you need to set sys.argv[] explicitly. Example: > *
> :python sys.argv = ["foo", "bar"]
> :pyfile myscript.py
> *"*
>
>
> I tried to pass argues to python file as this
>
> export def PyLinter(): void
> py3 import sys
> py3 sys.argv = ["--version"]
> exe 'py3f ' .. "path/to/somepythonfile.py"
> enddef
>
> It's like as if it had no effect : py3 sys.argv = ["--version"]
>
> Is it due to python3 file?
It works for me. Typing these commands in sequence:
py3 sys.argv = ["argument"]
py3file /tmp/test.py
With /tmp/test.py:
print("testing pyfile")
print(sys.argv)
print("testing end")
Output:
testing pyfile
['argument']
testing end
This is on Ubuntu, Python 3.10.
--
hundred-and-one symptoms of being an internet addict:
107. When using your phone you forget that you don't have to use your
keyboard.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///