Python os module open file above current directory with relative path
Tag : python , By : ChristianM
Date : March 29 2020, 07:55 AM
it fixes the issue The path given to open should be relative to the current working directory, the directory from which you run the script. So the above example will only work if you run it from the cgi-bin directory. A simple solution would be to make your path relative to the script. One possible solution. from os import path
basepath = path.dirname(__file__)
filepath = path.abspath(path.join(basepath, "..", "..", "fileIwantToOpen.txt"))
f = open(filepath, "r")
|
Batch File: Error in relative path , one level up from the current directory
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further Your attempt to use %~1 to go up one level in the directory structure is inventive and totally invalid syntax. The proper syntax is just as simple - use ..\. A leading \ is not required because %~dp0 ends with a \. %windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe %~dp0..\bin\ERecruitGenerateReportsWindowsService.exe
|
Is it possible to specify a #include file path relative to the user's current directory when compiling?
Tag : c , By : user150744
Date : March 29 2020, 07:55 AM
this will help If you consistently use <> includes, then the -I options in the makefile should be enough. The directory layout shows only one makefile, in the parent directory. That could use -Idir_a -Idir_b
#include <a.h>
#include <b.h>
|
How do I make JavaScript file paths relative to the current file directory?
Date : March 29 2020, 07:55 AM
it fixes the issue You shouldn't be including CSS and JS files directly in your WordPress templates. Rather, you should be enqueueing them properly (in functions.php) via wp_enqueue_style(): /**
* Proper way to enqueue scripts and styles
*/
function theme_name_scripts() {
wp_enqueue_style( 'style-name', get_stylesheet_directory_uri() . '/shThemeDefault.css' );
wp_enqueue_script( 'script-name', get_stylesheet_directory_uri() . '/js/example.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
|
How to look up a file and get its full path relative to current directory?
Tag : linux , By : user119413
Date : March 29 2020, 07:55 AM
To fix the issue you can do The answer is in ring bearer comment. I will just mark it here so that other people having the same issue can easily take the answer home. use find command as find . -name file_name
|