working-directory

NodeJs child_process working directory

╄→尐↘猪︶ㄣ 提交于 2019-11-30 04:39:05
I am trying to execute a child process in a different directory then the one of its parent. var exec = require('child_process').exec; exec( 'pwd', { cdw: someDirectoryVariable }, function(error, stdout, stderr) { // ... } ); I'm doing the above (though of course running "pwd" is not what I want to do in the end). This will end up writing the pwd of the parent process to stdout, regardless of what value I provided to the cdw option. What am I missing? (I did make sure the path passed as cwd option actually exists) The option is short for current working directory , and is spelled cwd , not cdw

How to set default working directory in Emacs - troubleshooting

烈酒焚心 提交于 2019-11-30 03:21:12
I know this has been posted many times, but the solutions are not working for me. I've tried the following solutions from this post ( Changing the default folder in Emacs ): Solution 1: Add (cd "C:/Users/Name/Desktop") to the .emacs file Solution 2: Add (setq default-directory "C:/Documents and Settings/USER NAME/Desktop/" ) to the .emacs file Solution 3: Right click the emacs short cut, hit properties and change the start in field to the desired directory. and only solution 3 is working. Unfortunately, I need to use either solution 1 or 2. I believe that my .emacs file is correct, because my

How to get R to recognize your working directory as its working directory?

你离开我真会死。 提交于 2019-11-30 01:43:12
I use R under Windows on several machines. I know you can set the working directory from within an R script, like this setwd("C:/Documents and Settings/username/My Documents/x/y/z") ... but then this breaks the portability of the script. It's also annoying to have to reverse all the slashes (since Windows gives you backslashes) Is there a way to start R in a particular working directory so that you don't need to do this at the script level? You should copy shortcut to R (R.lnk file) to desire folder. Then in "Properties" (right mouse button -> last option) delete anything in field "Start in...

Upstart node.js working directory

て烟熏妆下的殇ゞ 提交于 2019-11-29 17:20:53
问题 Starting Node.js with Upstart, when trying to access files within Node.js it cannot access them without using the full path. I need it to use the working directory. start on startup stop on shutdown script echo $$ > /var/run/mynodeapp.pid exec sudo -u mynodeapp node server.js >> /var/log/mynodeapp.sys.log 2>&1 end script pre-start script echo "Starting" >> /var/log/mynodeapp.sys.log end script pre-stop script rm /var/run/mynodeapp.pid echo "Stopping" >> /var/log/mynodeapp.sys.log end script

Working folder in ASP.NET

只愿长相守 提交于 2019-11-29 13:51:41
We have a web application written in ASP.NET 3.5. In it, we access a file in the code-behind. (Ordinary C# file access, done on the server during the page life-cycle, this has nothing to do with URLs or web browsers). On our production systems, we specify the full path to the file in question in the web.config. We'd like to be able to include a local copy of the file in the project in version control, and then to use a relative path in the version-controlled web.config to point to it, so that a checked-out copy of the application could be run from within Visual Studio's debugger without having

Gulp change working directory for entire task

时光毁灭记忆、已成空白 提交于 2019-11-29 09:22:41
I'm working on a gulp file that contains tasks for both the frontend and the backend of my site. The task below for example will concat my scripts into app.js: gulp.task 'frontend:scripts', -> gulp.src frontendPath(scriptsFolder, scriptsPattern) .pipe sourcemaps.init() .pipe coffee() .pipe concat 'app.js' .pipe sourcemaps.write('.') .pipe gulp.dest frontendPath(tempFolder, scriptsFolder) As you can see I've created a helper to provide the correct frontend path: frontendPath = (dirs...) -> path.join.apply null, ['frontend'].concat(dirs) But I have to be really careful that all the steps of my

Python: subprocess with different working directory [duplicate]

雨燕双飞 提交于 2019-11-29 09:19:23
This question already has an answer here: How can I specify working directory for popen 1 answer I have a python script that is under this directory: work/project/test/a.py Inside a.py , I use subprocess.POPEN to launch the process from another directory, work/to_launch/file1.pl, file2.py, file3.py, ... Python Code: subprocess.POPEN("usr/bin/perl ../to_launch/file1.pl") and under work/project/, I type the following [user@machine project]python test/a.py, error "file2.py, 'No such file or directory'" How can I add work/to_launch/ , so that these dependent files file2.py can be found? Your code

Python file open() in Enthought Canopy fails with: “IOError No such file or directory”

霸气de小男生 提交于 2019-11-29 04:25:24
I'm running code under Enthought Canopy to open and read a file. It keeps telling me IOError. But I am pretty sure the text file name is right and it is in the same directory with the Python file, and the code works well in other IDEs like Python IDLE. Don't know what's wrong. Any suggestions? inFile = open('words.txt', 'r') words = inFile.read().split() fails with IOError: [Errno 2] No such file or directory: 'words.txt' punchagan UPDATE: The following hack is not required in Canopy versions 1.0.3 and greater. Right click inside the Python pane, and select Keep Directory Synced to Editor .

How to get the current working directory using python 3?

走远了吗. 提交于 2019-11-28 22:18:36
When I run the following script in IDLE import os print(os.getcwd()) I get output as D:\testtool but when I run from cmd prompt, I get c:\Python33>python D:\testtool\current_dir.py c:\Python33 How do I get same result which I got using IDLE ? Maciek It seems that IDLE changes its current working dir to location of the script that is executed, while when running the script using cmd doesn't do that and it leaves CWD as it is. To change current working dir to the one containing your script you can use: import os os.chdir(os.path.dirname(__file__)) print(os.getcwd()) The __file__ variable is

How to set root folder for PHP include files

为君一笑 提交于 2019-11-28 18:25:41
I've spent days researching the internet and I can't find the answer that I will understand and are able to implement. I've got the website in which I want to use include_once files and be able to view the website properly in both localhost and the actual server. I've used $_SERVER['DOCUMENT_ROOT'] before but it doesn't work on the localhost so it is hard for me to update and do the changes to the website. What I want to do is to create some sort of config.php file in which I can tell it that the root folder is either called htdocs or public_html and to "start" looking for files from there. Or