> Traceback (most recent call last):
>    File "/home/pofuk/MzMFIleShare/sharePanel.py", line 130, in share
>      self.scanDirsAndFiles(dirPath)
>    File "/home/pofuk/MzMFIleShare/sharePanel.py", line 158, in
> scanDirsAndFiles
>      sql.insertData.insert("files", data)
> TypeError: unbound method insert() must be called with insertData
> instance as first argument (got str instance instead)
>
> share.py


<snip>


>         def scanDirsAndFiles(self, dirPath):
>                 for item in os.listdir(dirPath):
>                         if os.path.isdir(os.path.join(dirPath, item)):
>                                 scanDirsAndFiles(os.path.join(dirPath, item))
>                         if os.path.isfile(os.path.join(dirPath, item)):
>                                 user_name = login.getUserName()
>                                 fileName = item
>                                 fileSize = 
> os.path.getsize(os.path.join(dirPath, item))
>                                 filePathLocal = os.path.join(dirPath, item)
>                                 filePathFTP = ""
>                                 currentLocation = "Local"
>                                 FTP_valid_time = 7
>                                 uploaded = ""
>                                 lastModified = "NOW()"
>                                 lastVerified = "NOW()"
>                                 fileType = "file"
>                                 fileCategory = "Ostalo"
>
>                                 data = [fileName, fileSize, filePathLocal, 
> filePathFTP,
> currentLocation, FTP_valid_time, uploaded, lastModified, lastVerified,
> fileType, fileCategory]
>
>                                 sql.insertData.insert("files", data)
>


<snip>


> class insertData:
>         def insert(self, dataTable, data):
>                 conn = self.openConnection.openConnection()
>                 cursor = conn.cursor()
>                 sql ="INSERT INTO "+dataTable+" (user_name, file_name, 
> file_size,
> file_path_local, file_path_FTP, curent_location, FTP_valid_time,
> uploaded, last_modified, last_verified, file_type, file_category) VLAUES
> "+data
>                 cursor.execute(sql)
>                 conn.Close()

It doesn't look like you are instantiating the insertData class. You
would need to do something like:

# untested
foo = insertData()
foo.insert("files", data)


But I agree with Chris. You really do need to go through a tutorial on
using classes and following Python naming conventions. Dive Into
Python and some of the other online resources are very helpful.

This is something that I have trouble with myself since wxPython uses
CamelCase for classes and methods/functions and and most
recommendations for plain Python seem to only want CamelCase for
classes and something like myFunct or myMethod for the other objects.

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

Reply via email to