Skip to main content

All Questions

Tagged with
2 votes
1 answer
288 views

Where is the sys module located, or how to find it in Win 11 & Python

Does anyone know how to find where the sys module is installed in a Windows 11 install of anaconda3 & Python? I've tried looking in the Lib folder already and although there is a file called sys....
Tw3rkDaN3twerk's user avatar
2 votes
2 answers
325 views

When I append a path, python gives an error

I tried to add a directory path to sys.path, but it gives me an error: import sys sys.path.append("C:\Users\tamer\Desktop\code\python\modules") SyntaxError: (unicode error) 'unicodeescape' ...
mostafa ghobashy's user avatar
0 votes
0 answers
354 views

sys.argv is splitting path if path is too long, how to make it not do that?

Python 3.9, Windows 10 So, I have a python script that accepts files drag-dropped onto it, what it does to the files should not be relevant. Everything works fine except in the unusual cases where the ...
Oliver Henriksson's user avatar
1 vote
1 answer
1k views

open image files from window explorer using python code

i recently just took up python for my research studentship (so i don't have a very strong cs background). I'm dealing with a large set of image files in many different subfolders in a big folder so I ...
Matcha38's user avatar
1 vote
0 answers
1k views

Python can't import library installed using pip venv

I've looked at several posts and articles and I can't seem to find a solution to this. I need to use jenkspy for a specific task but my Python3x was installed with a software called ArcGIS Pro that ...
geoJshaun's user avatar
  • 709
0 votes
1 answer
62 views

How to open files and applications on Python

I have some Python code and I want to open some files, applications and folders. I tried to do this with sys and os - sys.open('C:\\Users\\___\\!FILMS!') os.open('C:\\Users\\___\\!FILMS!') but it isn'...
user avatar
0 votes
2 answers
142 views

How to make a script think it's running using a termnal?

I am using a python script(x.py) that required to be run using terminal, but I have a large list that need to be iterate so I did a script that can call the x.py but I could not save the output due to ...
Samah's user avatar
  • 15
1 vote
2 answers
2k views

Pass a file to Python via the Right-Click 'Open With' context menu in windows, to then open in another program

I use a piece of software that when you close, saves your current configuration, however, next time I open the software by clicking on a file associated with it, it tries to run that file through the ...
birdistheword99's user avatar
0 votes
2 answers
1k views

How to add a folder to the Windows PATH with Python?

I want to add a folder to the Windows PATH environment variable with Python. I tried these three code snippets but none worked: os.environ['PATH'] += ";C:\my\folder" and sys.path.insert(0, os.path....
SSH's user avatar
  • 5
0 votes
2 answers
2k views

Open files, specified by a path provided via sys.argv in Python on Windows?

Consider the program below, which purpose is to open some files, referenced by sys.argv[1] + "string". import sys def searchAndReplacePath(path): filesToSearch = [path + "\main\file1.txt", ...
GLaDER's user avatar
  • 345
1 vote
1 answer
1k views

print(sys.argv) doesn't take arguments

that's probably a pretty dumb question, but I'm a beginner programmer and i can't get this. basically, i think im using sys.argv wrong because it just doesn't take arguments as much as i can tell. ...
young marx's user avatar
0 votes
1 answer
764 views

convert batch file to python script using sys and subprocess

first i use python api from some program,and to can i do that i create .bat file with the paths and calls. but i want to convert this .bat file(with paths and calls) to python script using sys.paths ...
Chris Papas's user avatar
4 votes
1 answer
1k views

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'*...
shiva prasanth's user avatar
0 votes
1 answer
128 views

Windows version detection in Python not working

I'm building a component into a Python 2.7 script that determines what version of Windows the script is running on. I found a good solution located here from another Stack Overflow post which seemed ...
PTW-105's user avatar
  • 189
3 votes
1 answer
146 views

python sys.path implementation

today, I checked how sys.path got implemented by python. i found it points to sys.pi file(python 2.7.8 in windows). see code argv = [] __stdout__ = file(__file__) __name__ = 'sysoverride' __stderr__ ...
cppython's user avatar
  • 1,279

15 30 50 per page