473,383 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Symbolic Link

I am trying to create a link to a file, which I can then use in an
HTML page.

The system is Linux on a hosted web service, running python 2.3.
Other than that I have no knowledge of the system.

The link is created OK, but when I try to use it as filename for the
IMG TAG, it does not get displayed. The page source of the created
page is pointing to the link as temp/test1.jpg

Any ideas ?

srcFile = "temp/test2.jpg"

linkFile = "temp/test1.jpg"

if os.path.islink(linkFile):
print "Link Exists", nl
pass
else:
print "Making Link", nl
os.symlink(srcFile, linkFile)

print '<BR><img src="%s">the image</IMG><BR><BR>' % linkFile

print '<img src="%s">the image</IMG>' % srcFile

Aug 18 '07 #1
11 8106
mosscliffe schrieb:
I am trying to create a link to a file, which I can then use in an
HTML page.

The system is Linux on a hosted web service, running python 2.3.
Other than that I have no knowledge of the system.

The link is created OK, but when I try to use it as filename for the
IMG TAG, it does not get displayed. The page source of the created
page is pointing to the link as temp/test1.jpg

Any ideas ?

srcFile = "temp/test2.jpg"

linkFile = "temp/test1.jpg"

if os.path.islink(linkFile):
print "Link Exists", nl
pass
else:
print "Making Link", nl
os.symlink(srcFile, linkFile)

print '<BR><img src="%s">the image</IMG><BR><BR>' % linkFile

print '<img src="%s">the image</IMG>' % srcFile
In what environment is that script running? If it's apache, it might be
that the apache settings disallow for following links.

Diez
Aug 18 '07 #2
On 18 Aug, 23:49, "Diez B. Roggisch" <de...@nospam.web.dewrote:
mosscliffe schrieb:
I am trying to create a link to a file, which I can then use in an
HTML page.
The system is Linux on a hosted web service, running python 2.3.
Other than that I have no knowledge of the system.
The link is created OK, but when I try to use it as filename for the
IMG TAG, it does not get displayed. The page source of the created
page is pointing to the link as temp/test1.jpg
Any ideas ?
srcFile = "temp/test2.jpg"
linkFile = "temp/test1.jpg"
if os.path.islink(linkFile):
print "Link Exists", nl
pass
else:
print "Making Link", nl
os.symlink(srcFile, linkFile)
print '<BR><img src="%s">the image</IMG><BR><BR>' % linkFile
print '<img src="%s">the image</IMG>' % srcFile

In what environment is that script running? If it's apache, it might be
that the apache settings disallow for following links.

Diez
It is Apache.

Can I create some override in the current directory. I am afraid my
Apache skills are almost zero.

Thanks

Richard

Aug 19 '07 #3
mosscliffe schrieb:
On 18 Aug, 23:49, "Diez B. Roggisch" <de...@nospam.web.dewrote:
>mosscliffe schrieb:
>>I am trying to create a link to a file, which I can then use in an
HTML page.
The system is Linux on a hosted web service, running python 2.3.
Other than that I have no knowledge of the system.
The link is created OK, but when I try to use it as filename for the
IMG TAG, it does not get displayed. The page source of the created
page is pointing to the link as temp/test1.jpg
Any ideas ?
srcFile = "temp/test2.jpg"
linkFile = "temp/test1.jpg"
if os.path.islink(linkFile):
print "Link Exists", nl
pass
else:
print "Making Link", nl
os.symlink(srcFile, linkFile)
print '<BR><img src="%s">the image</IMG><BR><BR>' % linkFile
print '<img src="%s">the image</IMG>' % srcFile
In what environment is that script running? If it's apache, it might be
that the apache settings disallow for following links.

Diez

It is Apache.

Can I create some override in the current directory. I am afraid my
Apache skills are almost zero.
As are mine. At least from the top of my head. You better ask in a more
apache-centric forum.

Diez
Aug 19 '07 #4
mosscliffe wrote:
I am trying to create a link to a file, which I can then use in an
HTML page.

The system is Linux on a hosted web service, running python 2.3.
Other than that I have no knowledge of the system.

The link is created OK, but when I try to use it as filename for the
IMG TAG, it does not get displayed. The page source of the created
page is pointing to the link as temp/test1.jpg
What are you trying to do that you can't use the original file instead
of creating a link? There might be a way to side-step the entire problem.
Aug 19 '07 #5
On 19 Aug, 13:16, samwyse <dejan...@email.comwrote:
mosscliffewrote:
I am trying to create a link to a file, which I can then use in an
HTML page.
The system is Linux on a hosted web service, running python 2.3.
Other than that I have no knowledge of the system.
The link is created OK, but when I try to use it as filename for the
IMG TAG, it does not get displayed. The page source of the created
page is pointing to the link as temp/test1.jpg

What are you trying to do that you can't use the original file instead
of creating a link? There might be a way to side-step the entire problem.
The source file is in an area which python can see, but not the
browser. I am trying to make a link in a browser friendly area so I
can use it to display an image file.

Thanks

Richard

Aug 19 '07 #6
On Aug 19, 4:29 pm, mosscliffe <mcl.off...@googlemail.comwrote:
The source file is in an area which python can see, but not the
browser. I am trying to make a link in a browser friendly area so I
can use it to display an image file.
You might want to try using an .htaccess file. Place a file
called .htaccess in the "browser friendly area" and place in it the
line:

Options +FollowSymLinks

Assuming your hosting service will allow that, then it should work.
If not, then why not just copy the image files? Storage is cheap
these days.

Hyuga

Aug 20 '07 #7
Hyuga wrote:
On Aug 19, 4:29 pm, mosscliffe <mcl.off...@googlemail.comwrote:
>The source file is in an area which python can see, but not the
browser. I am trying to make a link in a browser friendly area so I
can use it to display an image file.

You might want to try using an .htaccess file. Place a file
called .htaccess in the "browser friendly area" and place in it the
line:

Options +FollowSymLinks

Assuming your hosting service will allow that, then it should work.
If not, then why not just copy the image files? Storage is cheap
these days.

Hyuga
My question would be why a symbolic link? Why not a hard link? Are the
two directories on different mount points? After the script finishes
does python need to see that image file again? Why not just move it?

Ian

Aug 21 '07 #8
On 22 Aug, 00:05, Ian Clark <icl...@mail.ewu.eduwrote:
Hyuga wrote:
On Aug 19, 4:29 pm,mosscliffe<mcl.off...@googlemail.comwrote:
The source file is in an area which python can see, but not the
browser. I am trying to make a link in a browser friendly area so I
can use it to display an image file.
You might want to try using an .htaccess file. Place a file
called .htaccess in the "browser friendly area" and place in it the
line:
Options +FollowSymLinks
Assuming your hosting service will allow that, then it should work.
If not, then why not just copy the image files? Storage is cheap
these days.
Hyuga

My question would be why a symbolic link? Why not a hard link? Are the
two directories on different mount points? After the script finishes
does python need to see that image file again? Why not just move it?

Ian
I just imagined a symbolic link would be quicker.

I have tested a hard link now and it seems to work fine. I am
deleting the link/s at the end of the session/s.

I think a link is better than a move, because there is always a
possibility I might somehow delete the moved file and then I would
lose the original one.

Thanks for your help.

Richard

Aug 23 '07 #9
In message <ma*************************************@python.or g>, Ian Clark
wrote:
My question would be why a symbolic link? Why not a hard link?
Because of the potential for confusion. For instance, modifying the file
without realizing that some other place expects to see the unmodified
version.
Aug 31 '07 #10
mosscliffe wrote:
On 22 Aug, 00:05, Ian Clark <icl...@mail.ewu.eduwrote:
>>
>>>On Aug 19, 4:29 pm,mosscliffe<mcl.off...@googlemail.comwrote:

The source file is in an area which python can see, but not the
browser. I am trying to make a link in a browser friendly area so I
can use it to display an image file.

My question would be why a symbolic link? Why not a hard link? Are the
two directories on different mount points? After the script finishes
does python need to see that image file again? Why not just move it?

I have tested a hard link now and it seems to work fine. I am
deleting the link/s at the end of the session/s.
This is a bit late, but the reason the symbolic link won't work is
because it's the web-server that's resolving it. The browser can only
see things that the web-server, huh, serves, so what was meant in the
first paragraph above was that the web server couldn't access the file
in its original location. If you create a sym-link, the web server
opens the link, finds out the actual location of the file, and tries to
open that file, which it still can't do. A hard-link, OTOH, allows
direct access to the contents of a file, as long as it is on the same
filesystem. No extra steps are required, so the process runs a few
microseconds faster, and directory-level permissions can't get in the way.
Sep 10 '07 #11
In message <1o******************@newssvr11.news.prodigy.net >, samwyse wrote:
A hard-link, OTOH, allows
direct access to the contents of a file, as long as it is on the same
filesystem. No extra steps are required, so the process runs a few
microseconds faster, and directory-level permissions can't get in the way.
Hard links are best avoided, because of the confusion they can cause.
Sep 10 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Markus | last post by:
Hello, I'm running on Mac OS X and need to create a soft link to a file. I tried both makealias() and link(). While makealias creates a Finder alias just fine my application that needs to read...
1
by: chris kittell | last post by:
Hi All, on db2 v8.1 for linux 32 bit redhat 7.3, when installing fixpak6,it's overwriting the symbolic link that I defined for the install directory, and proceeding to fill up my root partition....
3
by: Conrad | last post by:
Hi, it seems that I have the following issue when trying to create a symbolic link within a script: FROM COMMAND LINE: The owner is set to myself. Thus, it works. FROM WEB PAGE: It doesn't...
22
by: mp | last post by:
i have a python program which attempts to call 'cls' but fails: sh: line 1: cls: command not found i tried creating an alias from cls to clear in .profile, .cshrc, and /etc/profile, but none...
3
by: TK | last post by:
Hi, how can I check wether a file a symbolic link is? Thanks for help. o-o Thomas
4
by: TK | last post by:
Hi, I have to know whether a typical file (under Linux) a symbolic link is (in the sense of the stat()-Funktion). How can I check it excactly? Thanks for help. o-o THomas
8
by: Mini Singh | last post by:
Hello Friends I had built a library on Linux. Now i want to copy the lib folder containing symbolic links to windows. but when i copied those to windows each link is getting exactly the same...
1
by: amygrant1701 | last post by:
Hi, I've done this before so I don't see what I could doing wrong here. I'm running mysql 5x on freebsd. I'm using the default data directory of "/var/db/mysql" In there I have several dozen...
1
by: andredz | last post by:
Is there away to access some NFS symlink files that are set using absolute paths from Windows? I'm able to access symlink files is there are set using relative paths. Assume on Linux (mylinux):...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.