[cs615asa] Expanding ~

Kun Yao kyao at stevens.edu
Mon Mar 31 11:56:33 EDT 2014


Hi, I'm using python, and using this function to convert into abs path, it
works fine for me.

def full_path(dir_):

    if dir_[0] == '~' and not os.path.exists(dir_):

        dir_ = os.path.expanduser(dir_)

    return os.path.abspath(dir_)

Kun


On Mon, Mar 31, 2014 at 11:53 AM, Jin Sun <jsun6 at stevens.edu> wrote:

> Sorry can't
> On Mar 31, 2014 11:52 AM, "Jin Sun" <jsun6 at stevens.edu> wrote:
>
>> i get the same result, I think is because you can use ~ in shell script.
>> This will not be explained.
>> On Mar 31, 2014 11:41 AM, "Jin Sun" <jsun6 at stevens.edu> wrote:
>>
>>> dont use ~
>>> On Mar 31, 2014 11:40 AM, "Paul-Anthony Dudzinski" <pdudzins at stevens.edu>
>>> wrote:
>>>
>>>> Hello,
>>>> I am running into a bit of trouble when I try to override the ssh flags
>>>> in my program when I pass ~ for the home directory:
>>>>
>>>> So if I do
>>>>
>>>> export EC2_BACKUP_FLAGS_SSH="-i ~/.aws/lnxLab.pem"
>>>>
>>>> and then run the program I get:
>>>>
>>>> Warning: Identity file ~/.aws/lnxLab.pem not accessible: No such file
>>>> or directory. Warning:  Permanently added '
>>>> ec2-54-85-193-109.compute-1.amazonaws.com,54.85.193.109' (ECDSA) to
>>>> the   Permission denied (publickey).
>>>>
>>>>
>>>> However when I pass the absolute path it works just fine. My intuition
>>>> is that ssh might be looking in /etc/passwd for my home directory (where I
>>>> have no entry on lnxlab) and then looking for the literal file :
>>>> ~/.aws/lnxLab.pem when it doesnt find a home directory for my user id.
>>>>
>>>> Is anyone else having this problem?
>>>>
>>>> _______________________________________________
>>>> cs615asa mailing list
>>>> cs615asa at lists.stevens.edu
>>>> https://lists.stevens.edu/mailman/listinfo/cs615asa
>>>>
>>>>
> _______________________________________________
> cs615asa mailing list
> cs615asa at lists.stevens.edu
> https://lists.stevens.edu/mailman/listinfo/cs615asa
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.stevens.edu/mailman/private/cs615asa/attachments/20140331/61e01acc/attachment.html>


More information about the cs615asa mailing list