0

I am using paramiko module to ssh to linux box in my automation script. On the local server VM, when I check the time it would be displayed in EDT timezone. But after connecting through paramiko when I try to get the time by executing the exec_command('date'), the output is displayed in UTC timezone.

Is there a way to retain the timezone of the linux server rather than it automatically converting it to UTC timezone.

  • Do I understand correctly that you *"connect through paramiko"* to the *"local server VM"* - and you get different results of `date` command, when you execute it via Paramiko and when you execute it in (local?) terminal? – Martin Prikryl Aug 07 '18 at 13:37
  • Yes, when I execute it locally i am getting the time in EDT timezone like -Wed Aug 8 06:02:06 EDT 2018 But whn I execute the date function after connecting through paramiko i get it like - Wed Aug 8 10:02:06 UTC 2018 – preethi gnanesh Aug 08 '18 at 10:03
  • Except that in your case the difference is not due to `PATH` variable, but `TZ` variable. – Martin Prikryl Aug 08 '18 at 10:14
  • How can I resolve this error – preethi gnanesh Aug 08 '18 at 11:25
  • What is not clear about my answer to the duplicate question? + Also make sure you follow the link to https://stackoverflow.com/q/40021860/850848. – Martin Prikryl Aug 08 '18 at 11:33

0 Answers0