473,508 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8109
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
7261
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
2091
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
7711
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
4198
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
2775
by: TK | last post by:
Hi, how can I check wether a file a symbolic link is? Thanks for help. o-o Thomas
4
3361
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
17890
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
8339
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
3395
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):...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.