-2

"ValueError: need more than 1 value to unpack - Learn Python the Hard Way Ex: 13"

This problem has been discussed a lot of times on this forum. Is there a way to pass on the arguments in the Notepad++ editor itself?

Writing the code in the Notepad++ editor and then executing it on python's default environment after providing the arguments should make this work - but can we directly pass the arguments from notepad++?

P.S - Just started with python - no prior knowledge.

James Z
  • 12,209
  • 10
  • 24
  • 44
A S
  • 11
  • 4
  • possible duplicate of [How to Execute a Python File in Notepad ++?](http://stackoverflow.com/questions/1702586/how-to-execute-a-python-file-in-notepad) – no coder Jun 01 '15 at 04:58

2 Answers2

1

Passing command line arguments can only be done on the command line itself.

Or you can call it via another Python program using os.system to execute command line arguments.

os.system : Execute the command (a string) in a subshell. This is implemented by calling the Standard C function system(), and has the same limitations

import os
os.system("Program_Name.py Variable_Number_Of_Arguements"

You could also use call from subprocess:

from subprocess import call
call(["Program.py", "Arg1", "Arg2"])
Meghdeep Ray
  • 5,262
  • 4
  • 34
  • 58
0

Yes, it is possible.

After writing code in Nodepad++, click File > Open Containing Folder > cmd.

This will open up a cmd window where you can type a query like below:

python filename.py arguments
tessafyi
  • 2,273
  • 2
  • 19
  • 28
  • I'm not sure this quite addresses the question- it seems like this run Python through a separate `cmd` window rather than directly in Notepad++. It is a nice shortcut for that, though – tessafyi Jul 04 '19 at 04:31