0

I recently had to install for a local user on Centos7 a more recent version of python2.7(.10) than the default one (2.7.5) could not handle a task.

With one of my script, I have a weird issue. Here is the import section of my script:

#!/bin/env python2.7
import os
import sys
if not os.name=='nt':
    sys.path.append('/usr/lib64/python2.7/site-packages')
    sys.path.append('/usr/lib/python2.7/site-packages')

from bingads.service_client import ServiceClient
from bingads import authorization, reporting
from bingads import *
import webbrowser
from suds import WebFault
import datetime
import psycopg2

So this basically doesn't work and returns a missing module error, stating that ServiceClient cannot be found

Yet, if I comment out:

sys.path.append('/usr/lib/python2.7/site-packages')

then the module is found but then psycopg2 is not found anymore (althought it would be found without commenting the previous line...)

It really makes no sens to me... Anyone encountered this error?

Breathe
  • 714
  • 5
  • 21
  • Is the older version of python still present? If so, how are you ensuring that this script is executed with the newer version? – John Gordon Sep 16 '16 at 16:02
  • Sorry, I updated the post: I am always putting #!/bin/env python2.7. python2.7 -V returns 2.7.10 – Breathe Sep 16 '16 at 16:08
  • 1
    Have you tried reordering the path appends? Perhaps it is looking in lib64 first and finding a version of bingads that doesn't have ServiceClient defined? – Leo Sep 16 '16 at 16:32
  • I tried but didn't work. Yet, yoou made me find a few articles on how one should never use the default python version of CentOS. I guess I'll just set up a new server and go for virtualenv right away :) Thanks both – Breathe Sep 19 '16 at 14:36

0 Answers0