relative-path

Python imports relative path

孤街浪徒 提交于 2019-12-03 01:44:27
I've got a project where I would like to use some python classes located in other directories. Example structure: /dir +../subdirA +../subdirB +../mydir The absolute path varies, because this project is run on different machines. When my python file with MySampleClass located in /mydir is executed, how do I import OtherClassRoot located in /dir or OtherClassA located in /subdirA ? I tried things like: from . import MySampleClass as msc or from ../ import MySampleClass as msc but this always fails or gives me error messages like Attempted relative import in non-package So, whats the right way

NodeJS - convert relative path to absolute

邮差的信 提交于 2019-12-03 00:58:10
In my File-system my working directory is here: C:\temp\a\b\c\d and under b\bb there's file: tmp.txt C:\temp\a\b\bb\tmp.txt If I want to go to this file from my working directory, I'll use this path: "../../bb/tmp.txt" In case the file is not exist I want to log the full path and tell the user: "The file C:\temp\a\b\bb\tmp.txt is not exist" . My question: I need some function that convert the relative path: "../../bb/tmp.txt" to absolute: "C:\temp\a\b\bb\tmp.txt" In my code it should be like this: console.log("The file" + convertToAbs("../../bb/tmp.txt") + " is not exist") Use path.resolve try

Java Paths.get … readAllBytes(path)) not working with relative path

寵の児 提交于 2019-12-02 22:03:26
问题 I am new to Java and trying to build an FX application. One of my function aims at replacing certain strings with others. The script works fine as long as I define the absolute path of the target file, but breaks when I work with the relative path. The problem is in the method "readAllBytes", that only works with the complete path. But I need relative path, since the folder location will vary. The target file is in the project folder. Is there any other method I can use to read the file

PHP require() relative path error

时光毁灭记忆、已成空白 提交于 2019-12-02 20:02:27
i have the following file structure: rootDIR dir1 subdir1 file0.php file1.php dir2 file2.php file3.php file4.php file1.php requires file3 and file4 from dir2 like this : require('../../dir2/file3.php') file2.php requires file1.php like this : require('../dir1/subdir1/file1.php') BUT then require in file1 fails to open file3 and file4 ( maybe due to the path relativeness) However what is the reason and what can I do for file2.php so file1.php properly require file3 and file4 Try adding dirname(__FILE__) before the path, like: require(dirname(__FILE__).'/../../dir2/file3.php'); It should include

How to Relocate Visual Studio project (.sln) file

不羁的心 提交于 2019-12-02 16:59:08
I would like to move the Visual Studio solution (myProject.sln) file into a folder. The problem with doing this is that all the relative paths in the project will break, how can you relocate the project without updating all relative paths inside the project manually? Thanks. Just click on the solution in the Solution Explorer and then click on "Save myProject.sln as..." in the File Menu. This will save your .sln in the folder that you choose without breaking the references. open the .sln file inside notepad or similiar, near the top it has the relative base path - modify that to suit your

TinyMCE 404/undefined

不羁岁月 提交于 2019-12-02 16:23:01
问题 I am using TinyMCE with Twitter Bootstrap v3.1 in a Q/A application. For some reason I am getting multiple 404 errors from TinyMCE in console: GET http://localhost/assets/lib/TinyMCE/themes/modern/themeundefined.js 404 (Not Found) tinymce.min.js:3 Failed to load: /assets/lib/TinyMCE//themes/modern/themeundefined.js As far as I can see the path is correct. I have typed the path directly into the browser bar (without undefinedtheme.js) and it pops up. Full path to TinyMCE is: http://localhost

What does the path get from the server by getRealPath () in jsp

女生的网名这么多〃 提交于 2019-12-02 14:08:48
I am using struts 1.3,jsp for developing application. I want to know what following code will return path from the server. path = getServlet().getServletContext().getRealPath("/") +"images\\logos\\"+ formFile.getFileName(); What will be the path from the server.Can i use this path for showing image on the page. First of all: getRealPath is deprecated. (compare: Interface ServletRequest ). You should try this instead (since spec 2.1): ServletContext context = session.getServletContext(); String realContextPath = context.getRealPath(request.getContextPath()); Earlier to this, it was highly

Change relative link paths for included content in PHP

时光总嘲笑我的痴心妄想 提交于 2019-12-02 11:50:25
问题 I have a PHP file at my server root.. index.php .. which include's .. DIR/ main.php Now .. DIR/ main.php .. has relative links to many nearby files. All the relative links are broken. Any way I can change the relative-URL base path for links? ... so the included content of DIR/ main.php has all its links to friend1.php changed to DIR/friend1.php . Edit: This in NOT about include's, this is about CHANGING ahref links en-masse. 回答1: The base tag in html works for relative links. See w3schools

Relative path from site root

送分小仙女□ 提交于 2019-12-02 10:07:46
I feel like a nub for asking this, but I can't figure it out.. I've found several posts ( here's one ) saying that to use a relative path from the root of your site, start the path with / , ex: <img src="/images/img1.jpg" /> My file hier. looks like -root -images -css -index.aspx -subFolder -test.aspx Now when I use the src path as shown above, it doesn't work in either index.aspx or test.aspx, but when I remove the / , it works for index.aspx. In test.aspx, I used ../images/img1.jpg and it works. What gives? Why is my example above not working? Your site is probably in a virtual directory, so

Java Paths.get … readAllBytes(path)) not working with relative path

…衆ロ難τιáo~ 提交于 2019-12-02 09:36:42
I am new to Java and trying to build an FX application. One of my function aims at replacing certain strings with others. The script works fine as long as I define the absolute path of the target file, but breaks when I work with the relative path. The problem is in the method "readAllBytes", that only works with the complete path. But I need relative path, since the folder location will vary. The target file is in the project folder. Is there any other method I can use to read the file content, that does not require the absolute path? Thanks a lot in advance. Below is the snippet: if