Search code examples
modulepython-3.5pyperclippythoninterpreter

Trouble while running python program


I have made a program asp.py and imported pyperclip module :

import pyperclip
pyperclip.copy('hrllo world')
pyperclip.paste()

and when I run this from terminal, with

python3 asps.py

it does not display any result what could be the reason that 'hrllo world' does not display?

result of above command

and moreover, if I run the same commands individually form python shell, it goes well. Have a look at it:

Result of individual code


Solution

  • it does not display

    of course it does not, because there's no portion of your code that outputs anything like print.

    Also, running commands in python shell is not directly equivalent to running in "normal" way, due to the subtle differences (i.e. if you just set variable like a=15 and then do just a you will see 15 in shell. In normally executed program you won't as you need to explicitly output the data using said print or others.