110 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
123
views
ghidra debugger current working directory
I'm trying to launch a native program from ghidra in linux. By using gdb the program launches, but the current working directory is different from the executable's and this causes problems. When it ...
1
vote
1
answer
123
views
Get case-sensitive CWD in C
In this code, when user inputs c:\\temp, getcwd() returns "c:\temp".
Actual path is C:\Temp.
if(chdir(fullpath))
{
perror("cd");
return 1;
}
if(!getcwd(path, sizeof(path))
{...
2
votes
0
answers
172
views
Why shouldn't we manually add paths to `sys.path`?
I read in multiple sources that it is not recommended to manually add paths to the list of paths sys.path that the Python interpreter checks when it encounters an import statement. However, I was not ...
1
vote
1
answer
571
views
os getcwd on command line vs editor
I am calling a python 3.10 file from the Anaconda command line (windows, in a conda environment) and noticed that when os.getcwd() is called within a script via command line, it outputs the root ...
1
vote
1
answer
305
views
Pytest is stopping with no results and Test results shows FileNotFoundError
I was trying to do a test that decompress files in a temp directory (made by a fixture), my function changes the current working directory in order to do some safe operations inside the folder.
...
0
votes
1
answer
160
views
Syscall param getcwd(buf) points to unaddressable byte(s)
I am testing a program using valgrind for the first time. I haven't found any help regarding this error. What am I doing wrong? how do I solve it?
Minimal reproducible example:
#include <sys/stat.h&...
1
vote
1
answer
24
views
file object open with relativ (variable) path
i want to open my selenium webdriver for edge with a relative way.
actually i does not work out with my code.
path_main = os.getcwd()
edge_path = str('\\') + 'build\msedgedriver.exe'
path_get = ...
1
vote
3
answers
366
views
What is the console equivalent of clicking on a command in a markdown file in PyCharm?
I have a folder with a README.md and a run.py that looks like this:
import os
assert __name__ == '__main__'
print('■しかく', __file__)
print('●くろまる', os.getcwd())
try:
os.mkdir('DELETE_ME')
except ...
0
votes
1
answer
134
views
Execve cd /bin pwd [C]
I am currently writing a shell in C (school project). My cd and pwd is working. But when I do: cd /bin and after pwd, pwd shows /usr/bin. For me it looks like execve with pwd can't handle /bin but why?...
0
votes
3
answers
371
views
What is the meaning of the getcwd() method?
import os
cwd = os.getcwd()
df.to_csv(cwd+ "/BA_reviews.csv")
I didn't understand this code properly. Can someone help?
0
votes
1
answer
171
views
os.getcwd() raise Exception with django dev server
I have a django project running inside docker, and the service is up with the command of python manage.py runserver, with file autoreload open, and using threadings.
My code invokes shutil....
2
votes
1
answer
2k
views
How to get the current path with symlink (not the actual path) in a c program on a linux system?
I am currently building a custom shell that can handle a few internal and external commands along with their options. One of these internal commands is pwd. From the man page of pwd, I got that pwd -L ...
0
votes
2
answers
298
views
Does getcwd() ignore the size of the buffer and copy it?
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
int main() {
char wd[10];
if(getcwd(wd,BUFSIZ) == NULL){ //BUFSIZ = 8192
perror("getcwd&...
0
votes
0
answers
188
views
getcwd() is faulty when in a programmed launched by abspath
Error
When an alias of python command runs on a file defined with an absolute path, its getcwd() becomes faulty, i.e. it doesn't represent my current location from which I'm running this script.
...
0
votes
1
answer
215
views
Isolate state change of chdir within python exec scope
Running a script with exec, how does one "backup" python process global state in its entirety and restores it afterwards?
code example:
import os
print(os.getcwd())
a = 8
print(a)
exec_scope ...