relative-path

How do I “use” a Perl module in a directory not in @INC?

北慕城南 提交于 2019-11-26 19:43:18
I have a module in the parent directory of my script and I would like to 'use' it. If I do use '../Foo.pm'; I get syntax errors. I tried to do: push @INC, '..'; use EPMS; and .. apparently doesn't show up in @INC I'm going crazy! What's wrong here? ephemient use takes place at compile-time, so this would work: BEGIN {push @INC, '..'} use EPMS; But the better solution is to use lib , which is a nicer way of writing the above: use lib '..'; use EPMS; In case you are running from a different directory, though, the use of FindBin is recommended: use FindBin; # locate this script use lib "$FindBin:

Reading file using relative path in python project

為{幸葍}努か 提交于 2019-11-26 19:02:27
问题 Say I have a python project that is structured as follows: project /data test.csv /package __init__.py module.py main.py __init__.py : from .module import test module.py : import csv with open("..data/test.csv") as f: test = [line for line in csv.reader(f)] main.py : import package print(package.test) When I run main.py I get the following error: C:\Users\Patrick\Desktop\project>python main.py Traceback (most recent call last): File "main.py", line 1, in <module> import package File "C:\Users

Why would a developer place a forward slash at the start of each relative path?

梦想的初衷 提交于 2019-11-26 18:40:32
I am examining some code for a friend, and have found that the developer who built his site began each and every relative src , href , and include with a forward slash / . For example: src="/assets/js/jquery.js" I have never seen this before. So my question is, why would a developer place a forward slash / at the start of a relative path? It's done in order to root the path (making it an absolute path). It ensures that the path is not relative but read from the root of the site. This allows one to move a file around and not have to change the links to the different resources. Using your

Send redirect to relative path in JSP?

 ̄綄美尐妖づ 提交于 2019-11-26 18:24:51
问题 response.sendRedirect("../seja/izpisknjig.jsp"); the file in which I execute this line is index.jsp. the directory structure looks like this. project --index.jsp seja --izpisknjig.jsp How do I form the relative path to redirect to izpisknjig.jsp. 回答1: Most reliable would be to create a domain-relative URL with the context path included. response.sendRedirect(request.getContextPath() + "/seja/izpisknjig.jsp"); 回答2: You can use JSP taglib to do redirection. Content of index.jsp file : <jsp

How to go up a level in the src path of a URL in HTML?

ぃ、小莉子 提交于 2019-11-26 18:24:23
I am storing style sheets in {root}/styles while images in {root}/images for a website. How do I give the path in the style sheets to go look in the images directory for the specified images? e.g. In background-image: url('/images/bg.png'); Use .. to indicate the parent directory: background-image: url('../images/bg.png'); Use ../ : background-image: url('../images/bg.png'); You can use that as often as you want, e.g. ../../images/ or even at different positions, e.g. ../images/../images/../images/ (same as ../images/ of course) S.Akruwala Here is all you need to know about relative file paths

Absolute vs. relative paths

倖福魔咒の 提交于 2019-11-26 17:32:44
问题 If I use absolute paths, I can't move the whole directory to a new location. If I use relative paths, I can't move individual files to new locations. What's the solution here? Do you set up a config file that holds the root path and go from there? Or do you have a rule like: Never move files around? I've seen in some projects that people use dirname( FILE ). What is the point of that, I mean, why not simply leave it out since the dirname is relative anyway (depending on where the file sits)?

Relative import from parent directory

这一生的挚爱 提交于 2019-11-26 16:21:17
问题 How does one do a relative import from a parent directory? From meme/cmd/meme : import "../../../meme" This gives an ambiguous error: matt@stanley:~/gopath/src/bitbucket.org/anacrolix/meme/cmd/meme$ go get bitbucket.org/anacrolix/meme/cmd/meme can't load package: /home/matt/gopath/src/bitbucket.org/anacrolix/meme/cmd/meme/main.go:8:2: local import "../../../meme" in non-local package matt@stanley:~/gopath/src/bitbucket.org/anacrolix/meme/cmd/meme$ echo $GOPATH /home/matt/gopath How do I

slash(/) vs tilde slash (~/) in style sheet path in asp.net

耗尽温柔 提交于 2019-11-26 15:11:56
How these 2 paths are resolved in asp.net. why these 2 gives different path. At what time we need to go for these. <link href="/common/black_theme/css/style.css" rel="stylesheet"> (this is working) <link href="~/common/black_theme/css/style.css" rel="stylesheet"> (this is not working) As per my knowledge ~ represents root directory of the application "Common" is the folder under root of the website(named testsite.demo) in IIS physical path = D:\Physicalpath\WarpFirstSite\testsite.demo common folder location - D:\Physicalpath\WarpFirstSite\testsite.demo\common / - Site root ~/ - Root directory

PHP include absolute path

我怕爱的太早我们不能终老 提交于 2019-11-26 14:21:46
问题 I have a variable on my site called $basePath which is set as: $basePath = '/Systems/dgw/'; I am using it on all my css, js and images tags as so (shortened for better visibility): <link href="<?php echo $basePath; ?>include/assets/css/bootstrap.min.css"> I have no problem with those includes and they work fine in wherever file and in whatever folder I am. I have a certain included page which has the following line: <img src="<?php echo $basePath; ?>images/new_logo.png" alt="logo"/> And the

Determining application path in a Python EXE generated by pyInstaller

牧云@^-^@ 提交于 2019-11-26 14:11:05
I have an application that resides in a single .py file. I've been able to get pyInstaller to bundle it successfully into an EXE for Windows. The problem is, the application requires a .cfg file that always sits directly beside the application in the same directory. Normally, I build the path using the following code: import os config_name = 'myapp.cfg' config_path = os.path.join(sys.path[0], config_name) However, it seems the sys.path is blank when its called from an EXE generated by pyInstaller. This same behaviour occurs when you run the python interactive command line and try to fetch sys