On 2:59 PM, Pratik Khemka wrote:

  I think I did not frame the question in a proper manner..

I want to open pratik.html which is there in the same folder as the python 
program. I do not want to specify the path like you can see below in the code 
(blue) c:\Documents and Settings\My Documents..The reason for this is that I 
want the code to be portable , ie others should also be able to run the program 
on their computers in whichever folder they want to. In this situation the code 
wont work on other computers due to the path name specified.

Currently I am using this code below :
sheet.write(4,3,"file:///c:\Documents and Settings\My 
Documents\pratik.html",hyperlink_style)

What I want to know is that if there is a way to remove the blue part (path to 
file)..I think it should be possible because the file is present in the same 
folder as the python program..
Currently the hyperlink only works if the blue part is also there..I am sorry 
if this question probably does not belong to this group and maybe belongs more 
to the excel group.

Thanks a lot for all the help..I really aprreciate it..
Pratik

(You top-posted, so I had to remove all the earlier stuff which is now out of order.)

I'm assuming you're generating this spreadsheet from python. So if you know what the format of the string is, generate it accordingly. You can use __file__ to get full the path of the python script, use os.path.dirname() on it, and use os.path.join() to combine it with the "pratik.html". You might also need abspath().

Once the spreadsheet has been written, it's not portable to other machines. But fixing that would be an Excel problem, and you're asking in python forum.

DaveA

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to