Questions tagged [sys]

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.

1100 questions
4
votes
1 answer

What is meant by intercepting a Python call in the sys.exit documentation?

In the Python documentation, it is said that it is possible to intercept the exit call at the outer level. So what does "intercept at the outside level" actually mean here? More specifically, what is meant by intercepting a call?
Apurva Kunkulol
  • 445
  • 4
  • 17
4
votes
1 answer

How do we get PyCharm to recognize the sys module in Python 2.7 under Mac OSX El Capitan?

We upgraded to Mac OCX El Capitan and now PyCharm 3.4 seems to no longer recognize the sys module in Python 2.7: if we add an "import sys" line to our code, PyCharm puts a red line beneath it with the error "no module named sys." The sys module is…
Praxiteles
  • 5,802
  • 9
  • 47
  • 78
4
votes
2 answers

What is the difference between system variable and environment variables in CAPL script?

What is the difference between system variable and environment variables in CAPL script with example?
Sachin Bharambe
  • 263
  • 3
  • 4
  • 16
4
votes
1 answer

Passing sys.stdout as an argument to a process

I am passing "sys.stdout" as an argument to a process, and the process then writes to the "sys.stdout" while it does its stuff. import multiprocessing import sys def worker_with(stream): stream.write('In the process\n') if __name__ ==…
user3722440
  • 243
  • 1
  • 6
  • 14
4
votes
3 answers

input string in bio python via sys.argv

I want to give a string stored in a txt file as an argument to a python code via sys.argv command. This is the code called script.py import sys seq = sys.argv[1] print seq and this is the string stored in seq.txt: AAABBBCC Now when I run python…
Ssank
  • 3,367
  • 7
  • 28
  • 34
4
votes
1 answer

How can it be that len(sys.argv) <= 0?

In my code, the following error triggered, and I do not understand how this case can come up: if(len(sys.argv) > 0): doSomething() else: raise AttributeError("Could not parse script name") The above code is in a python class, which I import…
Droids
  • 262
  • 1
  • 9
4
votes
1 answer

What is the linux equivalent of sys.getwindowsversion()

There is no sys.getlinuxversion(), and I get the feeling I may have to piece it together from a few places (which is fine); but, maybe not? import sys, os from collections import namedtuple ## This defines an interface similar to the object that…
Inversus
  • 3,125
  • 4
  • 32
  • 37
4
votes
1 answer

Why sys.stdout.write() display the length of the string?

>>> import sys >>> sys.stdout.write("Hello") Hello5 >>> sys.stdout.write("My name is something") My name is something20 >>> As you see on the codes above, the outputs with the length of the string. Wondering why? Why this method display the…
GLHF
  • 3,835
  • 10
  • 38
  • 83
4
votes
3 answers

Resolving mixed slashes from sys.path and os.path.join

I need to resolve a disparity between the separator that sys.path is providing, and the separator that os.path.join is using. I mimicked this Esri method (Techniques for sharing Python scripts) to make my script portable. It is being used in Windows…
Erica
  • 2,399
  • 5
  • 26
  • 34
4
votes
2 answers

Change OS for unit testing in Python

I have some python code that I've been tasked with unit testing that had different branches for different OS's. For example: if sys.platform == 'win32': #DoSomething if sys.platform == 'linux2': #DoSomethingElse I want to unit test both…
GGMG-he-him
  • 394
  • 1
  • 7
  • 26
4
votes
1 answer

Difference between os.close(0) & sys.stdin.close()

I'm working on some Python code which is a CGI script called from Apache. The first thing the code does is (I believe) attempt to close stdin/stdout/stderr with the following: for fd in [0, 1, 2]: try: os.close(fd) except…
eddiewould
  • 1,555
  • 16
  • 36
4
votes
3 answers

PyQt application closes successfully, but process is not killed?

i just noticed that when i run a pyqt application and close it, the application closes , but the process is still alive. Apparently the process that was running does not close even after closing the application. Traceback (most recent call last): …
thecreator232
  • 2,145
  • 1
  • 36
  • 51
3
votes
3 answers

How do you identify a driver executable?

How do you determine whether a given exe or dll or sys file is actually a driver? I mean what differentiates a driver from a normal executable?
CodeWarrior
  • 1,239
  • 1
  • 14
  • 19
3
votes
1 answer

What are the differences between windows service and windows driver?

What are the differences between windows service and windows driver ? Don't they both run in kernel mode? Don't they both run in session0 in win vista&7
CnativeFreak
  • 712
  • 12
  • 27
3
votes
1 answer

Why is tqdm output directed to sys.stderr and not to sys.stdout?

Accordingo to the python python documentation concerning sys.stdou and sys.stderr: stdout is used for the output of print() and expression statements and for the prompts of input(); The interpreter’s own prompts and its error messages go to…
Heberto Mayorquin
  • 10,605
  • 8
  • 42
  • 46