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
-1
votes
1 answer

syscall read acting weird

c lang, ubuntu so i have a task - write a menu with these 3 options: 1. close program 2. show user id 3. show current working directory i can only use 3 libraries - unistd.h, sys/syscall.h, sys/sysinfo.h. so no printf/scanf i need to use an array of…
user3554255
  • 41
  • 2
  • 8
-1
votes
1 answer

Writing out to a gives no new file, but no error either

The goal: take an argument in argparse, test if that argument is true if true, write a file with the name specified after that argument Eg: in the command line: $ python printfile.py --out_arg fileOutput.txt ... would produce a…
Thomas Matthew
  • 2,826
  • 4
  • 34
  • 58
-1
votes
2 answers

How to write to a file in the Directory "/sys/....."

How can i edit the file in the sys directory using JNI and NDk in android. Actually i Need to edit these file "/sys/class/gpio/gpio41/value".
user1925921
  • 120
  • 1
  • 10
-2
votes
1 answer

Python 3.2 UnboundLocalError in Date to Day of the Week converter

Nooby Coder here! My assignment is to code something that prints the day of the week of any given date. My code is working fine but when I run anything that isn't in the correct format (i.e. "//2011" or "12/a/2011") it will give me this error: line…
-2
votes
1 answer

Import sys and sys.argv Not Responsive in VS Code Terminal

Edit(07/08/2023) I'm new to coding and was using the terminal/code wrong and did not understand what I was doing wrong. Resolved now and learnt the lesson. If you find yourself in a similar position, call the code with: Python filename.py 1 4 5 67…
-2
votes
1 answer

How do you 'catch' Email addresses inside a log file?

''' This program is to read through any number of inputs (that is only: .txt files) the user passes through the sys.argv (through the terminal only). The file should only be a .txt file. Which means there is a conditional. Then the program should…
JoelFU
  • 3
  • 3
-2
votes
1 answer

What is the meaning of float(sys.maxsize)?

I’m studying about sys.maxsize . As I know, sys.maxsize means largest “integer” value that py_ssize_t can store. and I compared float(sys.maxsize) and sys.maxsize. And I found there is difference between them which is point(.) Even though I put…
-2
votes
2 answers

NameError: name 'X' is not defined but it is

I'm currently working on a project and I keep getting this error when executing a Python script: File "D:\projects\company\spiders\country\spain\cities\runnables\short.py", line 22, in soup = get_soup_from_url(url,…
NukeSkull
  • 39
  • 6
-2
votes
1 answer

Index slicing in Python using ast and sys module

In a certain encrypted message which has information about the locations, the characters are jumbled such that first character of the first word is followed by the first character of the second word, then it is followed by second character of the…
Sam2021
  • 3
  • 4
-2
votes
1 answer

Using sys.argv for webscraping, and trying run it through CMD console. I am new to this, adn dont knwo how to solve "NoneType" error. Using pycharm

import sys import requests import csv import os from bs4 import BeautifulSoup def main(): url = input_arguments()[0] filename = input_arguments()[1] header = summary_info(url) data = data_scraping(url) …
JWchild
  • 1
  • 1
-2
votes
1 answer

What does adding 2 dots to a directory do within a sys.path list?

Looking at https://github.com/NVIDIA/TensorRT/blob/main/samples/python/introductory_parser_samples/onnx_resnet50.py There is this code: sys.path.insert(1, os.path.join(sys.path[0], "..")) which inserts the same working directory with 2 dots to…
user13174343
  • 235
  • 2
  • 10
-2
votes
2 answers

It says "ValueError: I/O operation on closed file" but i opened it

I want to get the console output in a .txt file. This is what i have: import sys print('some text') a='moretext.1'.split('.') sys.stdout = open('output.txt', 'w') print(a) sys.stdout.close() here it works but in my program don't. Does someone know…
user14478218
-2
votes
3 answers

maximum level of Python nested lists?

Is there a maximum amount of levels of nesting lists in Python? I've combed the documentation over and can't seem to find a direct answer on this. I have found in the SYS documentation (https://docs.python.org/3.8/library/sys) that the default level…
-2
votes
2 answers

(Beginner) Why my code skips some of the functions ? (Python 3)

I'm trying to write code that receives two texts and thereafter I am writing code that finds common words among the texts. This is put in a new list. sys.stdin.read() is being used instead of input() because I need to process a long piece of…
Aleshka
  • 11
  • 2
-2
votes
1 answer

How to use sys.exit() if input is equal to specific number

I am looking to correct this code so that when the user inputs 99999 then the code stops running, im also looking to make it so that if the user input is 999 it sets the total to 0 import sys def money_earned(): total = int() try: # try…
winterwolf
  • 17
  • 2