Error message: TypeError: uploadFile() got an unexpected keyword argument 'createVersion'.
4.0 - Collaboration and Deployment services Custimization Reference has documentation errors.
The section for uploadFile() API is in error for both, passing the file location as a fully qualified path and passing the file location as a ResourceID. From the uploadFile section (page 156 of CADS 4.0 Customization Reference on the website)
1) FULLY QUALIFIED PATH NAME:
from pes.api.PESImpl import PESImpl
pesImpl = PESImpl('admin', 'spss', 'localhost', '8080')
# here the location to upload the file is passed as a #fully qualified path
identificationSpecifier = pesImpl.uploadFile
(source='C:\Temp\Temp.txt',
target='/Temp Folder',
createVersion=True)
print identificationSpecifier.getIdentifier()
print identificationSpecifier.getVersionMarker()
print identificationSpecifier.getVersionLabel ()
When a call is made through PESImpl, an instance of identificationSpecifier is not returned or at least its properties (Identifier, Version Marker and VersionLabel) canot be interrogated as suggested by the documention.
Further, the createVersion attribute does not exist but rather the versionFlag attributed has to be passed.
2) Following are multiple attempts to make it work. Ultimately you have to read the source code to see what you have to do to make it work. The explanations are in CAPITALS at the beginning of each attempt. The program comes first and the end results (errors) come immediately after.
FIRST ATTEMPT - DOES NOT ACCEPT "createVersion" AS A VARIABLE
begin program .
from pes.api.PESImpl import PESImpl
pesImpl = PESImpl("admin", "spss", "localhost", "8080")
identificationSpecifier = pesImpl.uploadFile(source="C:\Temp\Temp.txt",target="0a58c3670016a7860000010dcee0eaa28219",createVersion=True)
print identificationSpecifier.getIdentifier()
print identificationSpecifier.getVersionMarker()
print identificationSpecifier.getVersionLabel()
end program .
C:\Python26\lib\site-packages\pes\util\swahandler.py:2: DeprecationWarning: the multifile module has been deprecated since Python 2.5
import StringIO, multifile, mimetools, tempfile, sys, random
Traceback (most recent call last):
File "", line 4, in
TypeError: uploadFile() got an unexpected keyword argument 'createVersion'
DOES NOT WORK WHEN THERE IS NO FLAG
begin program .
# sent from tech support
from pes.api.PESImpl import PESImpl
pesImpl = PESImpl("admin", "spss", "localhost", "8080")
identificationSpecifier = pesImpl.uploadFile(source="C:\Temp\Temp.txt",target="0a58c3670016a7860000010dcee0eaa28219")
print identificationSpecifier.getIdentifier()
print identificationSpecifier.getVersionMarker()
print identificationSpecifier.getVersionLabel()
end program .
Traceback (most recent call last):
File "", line 5, in
File "C:\Python26\lib\site-packages\pes\api\PESImpl.py", line 678, in uploadFile
uri = self.crImpl.uploadFile(source,target,versionFlag,contentLanguage)
File "C:\Python26\lib\site-packages\pes\api\CRImpl.py", line 953, in uploadFile
resourceSpecifier = self.getResource(destinationPath)
File "C:\Python26\lib\site-packages\pes\api\CRImpl.py", line 135, in getResource
response = self.crStub.getResource(request)
File "C:\Python26\lib\site-packages\pes\generatedfiles\CR_Services.py", line 106, in getResource
response = self.binding.Receive(getResourceResponse.typecode)
File "C:\Python26\lib\site-packages\ZSI\client.py", line 523, in Receive
self.ReceiveSOAP(**kw)
File "C:\Python26\lib\site-packages\ZSI\client.py", line 407, in ReceiveSOAP
self.ReceiveRaw()
File "C:\Python26\lib\site-packages\ZSI\client.py", line 362, in ReceiveRaw
response = self.h.getresponse()
File "C:\Python26\Lib\httplib.py", line 950, in getresponse
response.begin()
File "C:\Python26\Lib\httplib.py", line 390, in begin
version, status, reason = self._read_status()
File "C:\Python26\Lib\httplib.py", line 354, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine
MUST USE versionFlag AND NOT createVersion AS SUGGESTED BY DOCUMENTATION AND TECH SUPPORT...
begin program .
# sent from tech support
from pes.api.PESImpl import PESImpl
pesImpl = PESImpl("admin", "spss", "localhost", "8080")
identificationSpecifier = pesImpl.uploadFile(source="C:\Temp\Temp.txt",target="0a58c3670016a7860000010dcee0eaa28219", versionFlag=False)
print identificationSpecifier.getIdentifier()
print identificationSpecifier.getVersionMarker()
print identificationSpecifier.getVersionLabel()
end program .
Traceback (most recent call last):
File "", line 5, in
File "C:\Python26\lib\site-packages\pes\api\PESImpl.py", line 694, in uploadFile
raise self.createException(fe,pesResourceUtil.getResource(ResourceConstants.ERROR_UPLOADFILE),target=target)
pes.util.PESExceptions.ResourceNotFoundException: 0a58c3670016a7860000010dcee0eaa28219 does not exist.
MUST USE TARGET ID OF EXISTING OBJECT - CANNOT CREATE ON FLY EVEN WHEN ATTEMPTING TO COPY TO EXISTING OBJECT IT INDICATES IT CAN'T BE FOUND
begin program .
# sent from tech support
from pes.api.PESImpl import PESImpl
pesImpl = PESImpl("admin", "spss", "localhost", "8080")
identificationSpecifier = pesImpl.uploadFile(source="C:\Temp\Temp.txt",target="09412a4bf08db1150000012641ab5012814a", versionFlag=True)
print identificationSpecifier.getIdentifier()
print identificationSpecifier.getVersionMarker()
print identificationSpecifier.getVersionLabel()
end program .
Traceback (most recent call last):
File "", line 5, in
File "C:\Python26\lib\site-packages\pes\api\PESImpl.py", line 694, in uploadFile
raise self.createException(fe,pesResourceUtil.getResource(ResourceConstants.ERROR_UPLOADFILE),target=target)
pes.util.PESExceptions.ResourceNotFoundException: /Temp.txt does not exist.
FURTHER VERIFICATION OF PROBLEM - OBJECT MUST EXIST
begin program .
# sent from tech support
from pes.api.PESImpl import PESImpl
pesImpl = PESImpl("admin", "spss", "localhost", "8080")
identificationSpecifier = pesImpl.uploadFile(source="C:\Temp\Temp.txt",target="c0a801484ed6252c0000012658f356bc8090", versionFlag=True)
print identificationSpecifier.getIdentifier()
print identificationSpecifier.getVersionMarker()
print identificationSpecifier.getVersionLabel()
end program .
Traceback (most recent call last):
File "", line 5, in
File "C:\Python26\lib\site-packages\pes\api\PESImpl.py", line 694, in uploadFile
raise self.createException(fe,pesResourceUtil.getResource(ResourceConstants.ERROR_UPLOADFILE),target=target)
pes.util.PESExceptions.ResourceNotFoundException: /Temp.txt does not exist.
begin program .
ERROR MESSAGE SAYS NEW OBJECT c0a801484ed6252c0000012658f356bc8090 DOES NOT EXIST BUT IN FACT IT DOES
from pes.api.PESImpl import PESImpl
pesImpl = PESImpl("admin", "spss", "localhost", "8080")
identificationSpecifier = pesImpl.uploadFile(source="C:\Temp\Temp.txt",target="c0a801484ed6252c0000012658f356bc8090", versionFlag=False)
print identificationSpecifier.getIdentifier()
print identificationSpecifier.getVersionMarker()
print identificationSpecifier.getVersionLabel()
end program .
Traceback (most recent call last):
File "", line 5, in
File "C:\Python26\lib\site-packages\pes\api\PESImpl.py", line 694, in uploadFile
raise self.createException(fe,pesResourceUtil.getResource(ResourceConstants.ERROR_UPLOADFILE),target=target)
pes.util.PESExceptions.ResourceNotFoundException: c0a801484ed6252c0000012658f356bc8090 does not exist.
ONLY WORKING PROGRAM ... WHICH IS INCORRECTLY DOCUMENTED...
begin program .
from pes.api.PESImpl import PESImpl
pesImpl = PESImpl("admin", "spss", "localhost", "8080")
# identificationSpecifier = pesImpl.uploadFile(source="C:\Temp\Temp.txt", target="/Temp Folder", versionFlag=False)
identificationSpecifier = pesImpl.uploadFile(source="C:\Temp\Temp.txt", target="/Te
[{"Product":{"code":"SS69YH","label":"IBM SPSS Collaboration and Deployment Services"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Not Applicable","Platform":[{"code":"PF033","label":"Windows"}],"Version":"4.0","Edition":"","Line of Business":{"code":"LOB76","label":"Data Platform"}}]