Search Results

Search found 7 results on 1 pages for 'pylonsn00b'.

Page 1/1 | 1 

  • Python unicode Decode Error SUDs

    - by PylonsN00b
    OK so I have # -*- coding: utf-8 -*- at the top of my script and it worked for being able to pull data from the database that had funny chars(Ñ ,Õ,é,—,–,’,…) in it and store that data into variables...but I have run into other problems, see I pull my data, organize it, and then dump it into a variables like so: title = product[1] Where product[1] is from my database result set Then I load it up for Suds like so: array_of_inventory_item_submit = ca_client_inventory.factory.create('ArrayOfInventoryItemSubmit') for product in products: inventory_item_submit = ca_client_inventory.factory.create('InventoryItemSubmit') inventory_item_list = get_item_list(product) inventory_item_submit = [inventory_item_list] array_of_inventory_item_submit.InventoryItemSubmit.append(inventory_item_submit) #Call that service baby! ca_client_inventory.service.SynchInventoryItemList(accountID, array_of_inventory_item_submit) Where get_item_list sets product[1] to title and (including a whole bunch of other nodes): inventory_item_submit.Title = title So everything runs fine until I call ca_client_inventory.service.SynchInventoryItemList that contains array_of_inventory_item_submit which contains the title w/ the funky char...here is the error: Traceback (most recent call last): File "upload_all_inventory_ebay.py", line 421, in <module> ca_client_inventory.service.SynchInventoryItemList(accountID, array_of_inventory_item_submit) File "build/bdist.macosx-10.6-i386/egg/suds/client.py", line 539, in __call__ File "build/bdist.macosx-10.6-i386/egg/suds/client.py", line 592, in invoke File "build/bdist.macosx-10.6-i386/egg/suds/bindings/binding.py", line 118, in get_message File "build/bdist.macosx-10.6-i386/egg/suds/bindings/document.py", line 63, in bodycontent File "build/bdist.macosx-10.6-i386/egg/suds/bindings/document.py", line 105, in mkparam File "build/bdist.macosx-10.6-i386/egg/suds/bindings/binding.py", line 260, in mkparam File "build/bdist.macosx-10.6-i386/egg/suds/mx/core.py", line 62, in process File "build/bdist.macosx-10.6-i386/egg/suds/mx/core.py", line 75, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 102, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 243, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 182, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/core.py", line 75, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 102, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 298, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 182, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/core.py", line 75, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 102, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 298, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 182, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/core.py", line 75, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 102, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 243, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 182, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/core.py", line 75, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 102, in append File "build/bdist.macosx-10.6-i386/egg/suds/mx/appender.py", line 198, in append File "build/bdist.macosx-10.6-i386/egg/suds/sax/element.py", line 251, in setText File "build/bdist.macosx-10.6-i386/egg/suds/sax/text.py", line 43, in __new__ UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 116: ordinal not in range(128) Now what? My guess is my script can take in these funky chars because I have # -*- coding: utf-8 -*- at the top but Suds does NOT have that at the top of its files. Do I really want to go and change the Suds files...we all know this is the least desired last possible solution...what can I do?

    Read the article

  • Integers in TextNodes w/ Python minidom

    - by PylonsN00b
    I am working on an API using SOAP and WSDL. The WSDL expects integers to come through. I am fairly new to ALL of this, and constructing XML in Python. I have chosen to use minidom to create my SOAP message. So using minidom, to get a value into a node I found I have to do this: weight_node = xml_file.createElement("web:Weight") weight_contents = xml_file.createTextNode(weight) weight_node.appendChild(weight_contents) So say weight needs to go in as an integer and IS an integer. The function is 'createTextNode' does this mean its going to be text, or what I put in there has to be text? Again I am fairly new to all of this. So if what I have explained seems way off base, please speak up.

    Read the article

  • Python csv reader acting weird

    - by PylonsN00b
    So OK if I run this wrong code: csvReader1 = csv.reader(file('new_categories.csv', "rU"), delimiter=',') for row1 in csvReader1: print row1[0] print row1[8] category_sku = str(row[8]) if category_sku == sku: classifications["Craft"] = row[0] classifications["Theme"] = row[1] I get: Knitting 391 Traceback (most recent call last): File "upload_all_inventory_ebay.py", line 403, in <module> inventory_item_list = get_item_list(product) File "upload_all_inventory_ebay.py", line 294, in get_item_list category_sku = str(row[8]) NameError: global name 'row' is not defined Where Knitting and 391 are exactly right, of course I need to refer to row[8] as row1[8]...k so I do this: csvReader1 = csv.reader(file('new_categories.csv', "rU"), delimiter=',') for row1 in csvReader1: print row1[0] print row1[8] category_sku = str(row1[8]) if category_sku == sku: classifications["Craft"] = row1[0] classifications["Theme"] = row1[1] And I get this: ........... Crochet 107452 Knitting 107454 Knitting 107455 Knitting 107456 Knitting 107457 Crochet 108200 Crochet 108201 Crochet 108205 Crochet 108213 Crochet 108214 Crochet 108217 108432 Quilt 108451 108482 108488 Scrapbooking 108711 Knitting 122363 Needlework Beading Crafts & Decorating Crochet Crochet Crochet Traceback (most recent call last): File "upload_all_inventory_ebay.py", line 403, in <module> inventory_item_list = get_item_list(product) File "upload_all_inventory_ebay.py", line 292, in get_item_list print row1[0] IndexError: list index out of range Where the output you see there is every effing thing in column 0 and column 1 !!!!!!!!!! Why? And WHY is row1[0] out of range if it wasn't before. YAY Fridays!

    Read the article

  • SUDS rendering a duplicate node and wrapping everything in it

    - by PylonsN00b
    Here is my code: #Make the SOAP connection url = "https://api.channeladvisor.com/ChannelAdvisorAPI/v1/InventoryService.asmx?WSDL" headers = {'Content-Type': 'text/xml; charset=utf-8'} ca_client_inventory = Client(url, location="https://api.channeladvisor.com/ChannelAdvisorAPI/v1/InventoryService.asmx", headers=headers) #Make the SOAP headers login = ca_client_inventory.factory.create('APICredentials') login.DeveloperKey = 'REMOVED' login.Password = 'REMOVED' #Attach the headers ca_client_inventory.set_options(soapheaders=login) synch_inventory_item_list = ca_client_inventory.factory.create('SynchInventoryItemList') synch_inventory_item_list.accountID = "REMOVED" array_of_inventory_item_submit = ca_client_inventory.factory.create('ArrayOfInventoryItemSubmit') for product in products: inventory_item_submit = ca_client_inventory.factory.create('InventoryItemSubmit') inventory_item_list = get_item_list(product) inventory_item_submit = [inventory_item_list] array_of_inventory_item_submit.InventoryItemSubmit.append(inventory_item_submit) synch_inventory_item_list.itemList = array_of_inventory_item_submit #Call that service baby! ca_client_inventory.service.SynchInventoryItemList(synch_inventory_item_list) Here is what it outputs: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:ns0="http://api.channeladvisor.com/webservices/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://api.channeladvisor.com/webservices/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header> <tns:APICredentials> <tns:DeveloperKey>REMOVED</tns:DeveloperKey> <tns:Password>REMOVED</tns:Password> </tns:APICredentials> </SOAP-ENV:Header> <ns1:Body> <ns0:SynchInventoryItemList> <ns0:accountID> <ns0:accountID>REMOVED</ns0:accountID> <ns0:itemList> <ns0:InventoryItemSubmit> <ns0:Sku>1872</ns0:Sku> <ns0:Title>The Big Book Of Crazy Quilt Stitches</ns0:Title> <ns0:Subtitle></ns0:Subtitle> <ns0:Description>Embellish the seams and patches of crazy quilt projects with over 75 embroidery stitches and floral motifs. You&apos;ll use this handy reference book again and again to dress up wall hangings, pillows, sachets, clothing, and other nostalgic creations.</ns0:Description> <ns0:Weight>4</ns0:Weight> <ns0:FlagStyle/> <ns0:IsBlocked xsi:nil="true"/> <ns0:ISBN></ns0:ISBN> <ns0:UPC>028906018721</ns0:UPC> <ns0:EAN></ns0:EAN> <ns0:QuantityInfo> <ns0:UpdateType>UnShipped</ns0:UpdateType> <ns0:Total>0</ns0:Total> </ns0:QuantityInfo> <ns0:PriceInfo> <ns0:Cost>0.575</ns0:Cost> <ns0:RetailPrice xsi:nil="true"/> <ns0:StartingPrice xsi:nil="true"/> <ns0:ReservePrice xsi:nil="true"/> <ns0:TakeItPrice>6.95</ns0:TakeItPrice> <ns0:SecondChanceOfferPrice xsi:nil="true"/> <ns0:StorePrice>6.95</ns0:StorePrice> </ns0:PriceInfo> <ns0:ClassificationInfo> <ns0:Name>Books</ns0:Name> <ns0:AttributeList> <ns0:ClassificationAttributeInfo> <ns0:Name>Designer/Author</ns0:Name> <ns0:Value>Patricia Eaton</ns0:Value> </ns0:ClassificationAttributeInfo> <ns0:ClassificationAttributeInfo> <ns0:Name>Trim Size</ns0:Name> <ns0:Value></ns0:Value> </ns0:ClassificationAttributeInfo> <ns0:ClassificationAttributeInfo> <ns0:Name>Binding</ns0:Name> <ns0:Value>Leaflet</ns0:Value> </ns0:ClassificationAttributeInfo> <ns0:ClassificationAttributeInfo> <ns0:Name>Release Date</ns0:Name> <ns0:Value>11/1/1999 0:00:00</ns0:Value> </ns0:ClassificationAttributeInfo> <ns0:ClassificationAttributeInfo> <ns0:Name>Skill Level</ns0:Name> <ns0:Value></ns0:Value> </ns0:ClassificationAttributeInfo> <ns0:ClassificationAttributeInfo> <ns0:Name>Pages</ns0:Name> <ns0:Value>20</ns0:Value> </ns0:ClassificationAttributeInfo> <ns0:ClassificationAttributeInfo> <ns0:Name>Projects</ns0:Name> <ns0:Value></ns0:Value> </ns0:ClassificationAttributeInfo> </ns0:AttributeList> </ns0:ClassificationInfo> <ns0:ImageList> <ns0:ImageInfoSubmit> <ns0:PlacementName>ITEMIMAGEURL1</ns0:PlacementName> <ns0:FilenameOrUrl>1872.jpg</ns0:FilenameOrUrl> </ns0:ImageInfoSubmit> </ns0:ImageList> </ns0:InventoryItemSubmit> </ns0:itemList> </ns0:accountID> </ns0:SynchInventoryItemList> </ns1:Body> </SOAP-ENV:Envelope> See how it creates the accountID node twice and wraps the whole thing in it? WHY? How do I make it stop that?!

    Read the article

  • Python FTP grabbing and saving images issue

    - by PylonsN00b
    OK So I have been messing with this all day long. I am fairly new to Python FTP. So I have searched through here and came up w/ this: images = notions_ftp.nlst() for image_name in image_names: if found_url == False: try: for image in images: ftp_image_name = "./%s" % image_name if ftp_image_name == image: found_url = True image_name_we_want = image_name except: pass # We failed to find an image for this product, it will have to be done manually if found_url == False: log.info("Image ain't there baby -- SKU: %s" % sku) return False # Hey we found something! Open the image.... notions_ftp.retrlines("RETR %s" % image_name_we_want, open(image_name_we_want, "rb")) 1/0 So I have narrowed the error down to the line before I divide by zero. Here is the error: Traceback (most recent call last): File "<console>", line 6, in <module> File "<console>", line 39, in insert_image IOError: [Errno 2] No such file or directory: '411483CC-IT,IM.jpg' So if you follow the code you will see that the image IS in the directory because image_name_we_want is set if found in that directory listing on the first line of my code. And I KNOW it's there because I am looking at the FTP site myself and ...it's freakin there. So at some point during all of this I got the image to save locally, which is most desired, but I have long since forgot what I used to make it do that. Either way, why does it think that the image isn't there when it clearly finds it in the listing.

    Read the article

  • Sending one record from cursor to another function Postgres

    - by PylonsN00b
    FYI: I am completely new to using cursors... So I have one function that is a cursor: CREATE FUNCTION get_all_product_promos(refcursor, cursor_object_id integer) RETURNS refcursor AS ' BEGIN OPEN $1 FOR SELECT * FROM promos prom1 JOIN promo_objects ON (prom1.promo_id = promo_objects.promotion_id) WHERE prom1.active = true AND now() BETWEEN prom1.start_date AND prom1.end_date AND promo_objects.object_id = cursor_object_id UNION SELECT prom2.promo_id FROM promos prom2 JOIN promo_buy_objects ON (prom2.promo_id = promo_buy_objects.promo_id) LEFT JOIN promo_get_objects ON prom2.promo_id = promo_get_objects.promo_id WHERE (prom2.buy_quantity IS NOT NULL OR prom2.buy_quantity > 0) AND prom2.active = true AND now() BETWEEN prom2.start_date AND prom2.end_date AND promo_buy_objects.object_id = cursor_object_id; RETURN $1; END; ' LANGUAGE plpgsql; SO then in another function I call it and need to process it: ... --Get the promotions from the cursor SELECT get_all_product_promos('promo_cursor', this_object_id) updated := FALSE; IF FOUND THEN --Then loop through your results LOOP FETCH promo_cursor into this_promotion --Preform comparison logic -this is necessary as this logic is used in other contexts from other functions SELECT * INTO best_promo_results FROM get_best_product_promos(this_promotion, this_object_id, get_free_promotion, get_free_promotion_value, current_promotion_value, current_promotion); ... SO the idea here is to select from the cursor, loop using fetch (next is assumed correct?) and put the record fetched into this_promotion. Then send the record in this_promotion to another function. I can't figure out what to declare the type of this_promotion in get_best_product_promos. Here is what I have: CREATE OR REPLACE FUNCTION get_best_product_promos(this_promotion record, this_object_id integer, get_free_promotion integer, get_free_promotion_value numeric(10,2), current_promotion_value numeric(10,2), current_promotion integer) RETURNS... It tells me: ERROR: plpgsql functions cannot take type record OK first I tried: CREATE OR REPLACE FUNCTION get_best_product_promos(this_promotion get_all_product_promos, this_object_id integer, get_free_promotion integer, get_free_promotion_value numeric(10,2), current_promotion_value numeric(10,2), current_promotion integer) RETURNS... Because I saw some syntax in the Postgres docs showed a function being created w/ a input parameter that had a type 'tablename' this works, but it has to be a tablename not a function :( I know I am so close, I was told to use cursors to pass records around. So I studied up. Please help.

    Read the article

1