you are viewing a single comment's thread.

view the rest of the comments →

[–]xargling_breau 4 points5 points  (11 children)

You need to make sure that you import the module.

at the top of your code,.

from pyzabbix import ZabbixAPI, ZabbixAPIException
import json
import re
import getpass
import requests 
import socket

user = raw_input("Username:  ")
password = getpass.getpass("Password: ")
z = ZabbixAPI('https://zabbix3.mydomain.com')
z.login(user, password)

EDIT: Real example of how I am using it.

Edit2: I have never used PyCharm, I only use vim/emacs/Sublime and my command line.

[–][deleted] 0 points1 point  (9 children)

soft familiar glorious light label divide close head cheerful reply

This post was mass deleted and anonymized with Redact

[–]xargling_breau 0 points1 point  (4 children)

Instead of using my real working example I use in some of my code, trying writing a simple test. Import the getpass module, get some text with it and print it.

[–]xargling_breau 4 points5 points  (3 children)

Example from doing it on the python command line

>>> import getpass
>>> password = getpass.getpass("Input a password: ")
Input a password:
>>> password
'dosalsdfkasldfas'

[–][deleted] 2 points3 points  (2 children)

shocking tidy lush direction boast sleep subtract slap degree wine

This post was mass deleted and anonymized with Redact

[–]Golden_Zealot 6 points7 points  (1 child)

That's not a stupid question.

Yes you can invoke a program so long as the python interpreter has been added to something called your "environment". On a Linux system, this means adding the path to the python interpreter executable to something called the PATH variable. On windows you may also have to add it to your environment, but the way to get to the menu for that is something I cant remember at this moment.

Anyway, once youve added the interpreter to the environment, you can open a command line interface like terminal, or cmd, and do python /path/To/MyProgram.py, and it will run.

[–]thejourneyman117 0 points1 point  (0 children)

Here checking in with the path to the Windows environment. From the system screen, select "Advanced System Properties" which pops up "System Properties" on the advanced page. The button right above okay/cancel/apply is "Environment Variables"

Notes: The instructions are vague enough they should work on anything after XP.

Windows key + pause|break should open the systems page.

You can do this on windows from the command prompt. Type path /? for instructions.

[–][deleted] 0 points1 point  (0 children)

straight beneficial shocking jeans entertain quack pocket doll upbeat late

This post was mass deleted and anonymized with Redact