For questions about the Python module named sys. This tag is also used for questions relating to the Sys namespace - the root namespace for the Microsoft AJAX Library, which contains all fundamental classes and base classes.
Questions tagged [sys]
1100 questions
2
votes
4 answers
Call python-nmap PortScanner(), nmap not found
In my virtualenv I installed python-nmap and nmap is installed (OS X).
But if I call mmap like (virtualenv activated...):
import sys
sys.path.append('/usr/local/bin')
import nmap
nm = nmap.PortScanner()
I get the following error:
Raise…

user2883656
- 93
- 2
- 9
2
votes
2 answers
Write a file to disk only when first content is written into it
I open a file with :
mylog = open('test.log', 'w')
and sometimes some content is written in mylog during the running time of my application ; but sometimes nothing is written during the running time of the app, it depends.
In both cases, it seems…

Basj
- 41,386
- 99
- 383
- 673
2
votes
1 answer
what is the difference between BUILTIN modules and non builtin modules ?
I am confusing with python builtin modules and non builtin modules. Here I am using sys module to find the builtin modules,
import sys
def dump(module):
print module, "=>",
if module in sys.builtin_module_names:
print ""
…

dhana
- 6,487
- 4
- 40
- 63
2
votes
5 answers
Reading input from reader in python into string
I have a function in Python which takes in a "reader" (I hope that's the right term). Basically the function should be able to use a file, sys.stdin etc. It then has to read all the lines and store them intro a string.
Currently my function calls…

Asad S. Malik
- 157
- 1
- 1
- 10
2
votes
3 answers
Passing directory name from sys.argv in python
Quick question on passing arugments from sys. In the code below, I don't understand the data_dir = "." This data_dir is used in another section to represent a file directory, but I don't understand the = "." piece. I had thought sys.argv would…

user3180797
- 31
- 3
2
votes
1 answer
Cant get __import__() to dynamically import a module in python - I know this cause it doesn't show up in sys.modules
I wrote a small script. It's designed to search the python directory for all available modules (whether they are installed or not), then it is supposed to check what modules are currently loaded, then it offers an option to dynamically load a module…

Justin Carroll
- 1,362
- 1
- 13
- 37
2
votes
1 answer
Executable problems
I made a script in python 2.6. When I tried running it on the computer(Windows Vista Home Basic) it worked perfectly fine but when I tried making it in an .exe the problems started. The problems were that when I clicked on the executable on other…

user2727932
- 133
- 1
- 3
- 8
2
votes
2 answers
Python 3.3 Serial key generator list problems
I am making a serial key generator for a school exercise, and I am running into a small problem. When I run the program, and type in I want to make 20 serial keys, the program will make twenty of the same keys. The cause of this is in the for loop…

IPDGino
- 706
- 1
- 8
- 17
2
votes
2 answers
Python sys.argv negative argument index
Why should sys.argv with a negative index allow printing same value as sys.argv[0]? That too, it allows this up to number of arguments passed.
So, a call to hello.py at developers.google.com, such as the one below (with 3 arguments including script…

Sumit Nigam
- 255
- 3
- 13
2
votes
3 answers
Python: pygame.QUIT()
Just been messing around with pygame and ran into this error.
CODE:
import sys
import pygame
pygame.init()
size = width, height = 600, 400
screen = pygame.display.set_mode(size)
while 1:
for event in pygame.event.get():
if…

Mike
- 21
- 1
- 1
- 2
2
votes
0 answers
How to restore a hidden loadable kernel module from /sys/module and dealing with restoring holders_dir?
I'm playing with kernel module hiding on Linux Kernel 3.x. I try to hide and recover the module from /sys/module. Everything works fine on Kernel Version 3.0 and 3.2.6. I can load and unload the module and hide and unhide it. When I'm unloading the…

user1833005
- 21
- 2
2
votes
0 answers
"Sys is undefined" error in databinded page
I have a page with a formview that is generating the "Sys is undefined" error.
This is the only page that have this problem, so it is not an web.config error or IIS configuration error.
The page contains a formview with the three templates (item,…

Alex Pollan
- 863
- 5
- 13
1
vote
3 answers
Python 3: Using subprocess Instead Of os.system
I have a string called variable and need to do the subprocess equivalent of os.system. I've tried to find a way to do this but have only found:
variable2 = subprocess.Popen(args, stdout=subprocess.PIPE)
print variable2.communicate()[0]
However, I'm…

Eden Crow
- 14,684
- 11
- 26
- 24
1
vote
1 answer
Why Does Using the Python-YQL Module Change sys.path[0] to sys.path[1]?
When I import the python-yql (Yahoo Query Language) module into my Python project, the string representing the local directory path from which the Python script is envoked, which is normally stored in sys.path[0] is changed to sys.path[1].…

Kevin Gurney
- 1,411
- 11
- 20
1
vote
0 answers
my sys.argv[1] is not receiving value from my php
ive been trying to pass value from my php to python to save to my database but my sys.argv[1] is not receiving any value.
import firebase_admin
from firebase_admin import credentials, db
import mysql.connector
from datetime import datetime
import…

Jezreel Honrada
- 11
- 2