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
3
votes
1 answer
ERROR: Could not find a version that satisfies the requirement sys (from versions: none) ERROR: No matching distribution found for sys
On trying to install sys package in Python 3.7.4 version using IDLE, I am getting the below error:
Input : C:\Users\UserName\Downloads>pip install sys
Output :
Collecting sys
ERROR: Could not find a version that satisfies the requirement sys…

Monika
- 33
- 1
- 4
3
votes
2 answers
Where does python look if your sys.path uses relative directory?
I have a project like:
project/
foo/
other.py
bar/
baz.py
If I code something like:
import sys
sys.path.insert(0, '../foo')
from foo import other
It doesn't work. But if I move foo into the bar directory it works. I…

Rob
- 3,333
- 5
- 28
- 71
3
votes
1 answer
Using sys.argv in Python 3 with Python interpreter
I’m trying to figure out how to use sys.argv in Python 3.6, but can’t figure out how to make it work using the Python interpreter (I’m not even 100% sure I’m actually using the interpreter, a bit confused around the terminology with interpreter,…

Frankie
- 33
- 1
- 5
3
votes
1 answer
Change Python 3 sys.argv when calling a function
I have a program main.py which uses sys.argv to run functions from other modules:
e.g:
python main.py gui should run the main function in gui.py
python main.py server start should run the main function in server.py.
But if the program simply runs…

Geno Racklin Asher
- 325
- 3
- 12
3
votes
4 answers
Why can I not redirect STDOUT using "from sys import stdout"?
I'm trying to redirect the STDOUT of a python script to a file.
If STDOUT is imported from sys, the script's output does not get redirected to a file:
from sys import stdout
stdout = open("text", "w")
print("Hello")
However, if I import only sys…

Cat
- 55
- 8
3
votes
0 answers
pytest - ModuleNotFoundError - python 3.6.4
I have a project with this layout:
├── MANIFEST.in
├── README.md
├── __init__.py
├── company
│ ├── __init__.py
│ ├── api
│ │ ├── __init__.py
│ │ ├── auth.py
│ │ ├── debug.py
│ │ ├── exceptions.py
│ │ ├── reporting.py
│ │ …

Luke
- 1,794
- 10
- 43
- 70
3
votes
0 answers
How to get a list of paths to all files which have been loaded so-far
How might we obtain a list of paths to all files which have been loaded from after initial start-up, before the current code which is being executed, and the current code which is being executed?
The following was an idea I had:
import…

Toothpick Anemone
- 4,290
- 2
- 20
- 42
3
votes
1 answer
oracle: select * from tab for other types?
I can do a
select * from tab;
and get a list of tables (and apparently views) - are there similar views set up for other objects, such as sequences, etc?

chris
- 36,094
- 53
- 157
- 237
3
votes
3 answers
Why is the read() function deleting all the data in my file?
I was doing a project in which I had to make a multiclipboard. Here's what it'll do:
This multiclipboard would run through the Terminal. It will create a file named clipboardd and save all the copied texts over there. The person can add as many…

M.Hamel
- 375
- 1
- 3
- 10
3
votes
2 answers
I want to know what exactly sys.exit(-1) returns in python?
My code goes like this:
if (not Y):
print ("Can't print")
sys.exit(-1)
I am unable to understand what does the argument (-1) returns?

rohit singh
- 33
- 1
- 2
- 3
3
votes
3 answers
sys.stdout as default function argument
Suppose we have the following dummy function:
import sys
def writeline(text, stream=sys.stdout):
stream.write(text + '\n')
with open('/path/to/file', 'w') as f:
# writes to /path/to/file
writeline('foo', f)
# writes to standard…

farsil
- 955
- 6
- 19
3
votes
2 answers
Errors using sys from Python Embedded in C++
I am using Eclipse to run C++. In my code,I use a High Level Embedding of Python to run a function. When I try to use sys and import it. I get the error:
Fatal Python error: no mem for sys.argv
CODE:
#include
#include…

Y. Reznichenko
- 153
- 2
- 13
3
votes
1 answer
How to abort waiting for sys.stdin in python3?
I'm running a script with two threads, a thread reading from a subprocess, and the main thread.
inside the main thread, I'm reading from stdin, like so:
for line in sys.stdin:
if proc.poll() != None:
break
proc.stdin.write(line)
…

polemon
- 4,722
- 3
- 37
- 48
3
votes
1 answer
Difference between Synonyms in oracle
Below is the query i have used to analyse invalid dba objects from dba_objects in database and its returning with invalid objects:
select do.STATUS as CODE_STATUS, do.OBJECT_TYPE, do.OWNER, do.OBJECT_NAME from dba_objects do
WHERE…

Andrew
- 3,632
- 24
- 64
- 113
3
votes
1 answer
Why does sys.path have "c:\\windows\\system\python34.zip"?
When I imported sys,
>>> import sys
>>> sys.path
['', 'C:\\Program Files\\Python 3.5\\lib\\site-packages\\pyinstaller-3.0-py3.5.egg', **'C:\\Program Files\\Python 3.5\\python35.zip'**, 'C:\\Program Files\\Python 3.5\\DLLs', 'C:\\Program…

shiva prasanth
- 33
- 2