JohnnyCyp
Posts: 75
Joined: Sun Mar 31, 2019 11:05 pm

'bool' object is not callable

Fri May 24, 2019 8:41 am

Hello, how i solve this error in the line: shell=True(image_path,'rb')

Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "/home/pi/Project/functions.py", line 246, in ftpSession
shell=True(image_path,'rb') # file to send
TypeError: 'bool' object is not callable

Code: Select all

    def ftpSession(self, q, image_path, image_name):
      while True:
        try:
          urlopen('https://www.google.com')
          break
        except:
          print ('No active internet connection in order to upload the picture. Retry in 30 sec FTP')
        time.sleep(30)
      session = ftplib.FTP('ipRPi','username','pass') # Here you need to provide your ftp Host, Username and password
      session.cwd('image folder')                         #Give the correct folder where to store the image
      print ("FTP Connection established")
      shell=True(image_path,'rb')                  # file to send
      session.storbinary('STOR ' + image_name, file)     # send the file
      file.close()                                    # close file and FTP
      session.quit()
      link = 'ftp://ipRPi/imagefolder' + image_name # This line here generates a link of the uploaded picture based on your webserver
      print ("File has been uploaded!")
      return link

User avatar
DougieLawson
Posts: 35761
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: 'bool' object is not callable

Fri May 24, 2019 9:02 am

True is a boolean constant. It doesn't have any methods. So your

Code: Select all

shell=True(image_path,'rb')
is a syntax error. You've probably got that opening parenthesis in the wrong place.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Python”