python-2.7

UnicodeEncodeError: 'charmap' codec can't encode character 'u03a3' in position 409: character maps to <undefined>

UnicodeEncodeError: 'charmap' codec can't encode character 'u03a3' in position 409: character maps to <undefined> Question: I am running Python code to pull the issues from JIRA. This code is provided by Atlassian and they are using JiraOne Library. In the Config.Json file we have the following information. { "user": "[email protected]", "password": "<APITOKEN_HERE>", "url": "https://nexusfive.atlassian.net" } …

Total answers: 1

How to insert all rows from JSON_Object to SQL Table using Python

How to insert all rows from JSON_Object to SQL Table using Python Question: I am new to Python and APIs. Data is a result of API response. I have a json_object like below. json_object = json.dumps(data,indent=2) which has data like below. I successfully connected to SQL server localhost using pymssql but I need help in …

Total answers: 1

How to decrypt or convert Python Dictionary of lists to normal dictionary

How to decrypt or convert Python Dictionary of lists to normal dictionary Question: Very new to python and literally struggling to get this fixed. I have dictionary like below from json file. I believe this is being called as Dictionary of lists. MyDict = [{Key:[1,2,3,4]}, {Summary:[Text 1, Text 2, Text 3, Text 4]}] Expected Result: …

Total answers: 2

Using module as variable

Using module as variable Question: I am parsing through some code for an SSD simulator. The top module imports the package experiment. It later instantiates an object to this module as follows: from config_helper import experiment . . . if __name__ == ‘__main__’: . . experiment = RunFTL(args) experiment.run() Inside the experiment module, there is …

Total answers: 1

Check if a subkey in a JSON file exists

Check if a subkey in a JSON file exists Question: I want to create a condition to check if a subkey in a JSON file exists: with open(‘C:/files/response.json’) as json_file: data = json.load(json_file) if ‘XMLRESPONSE’ in data and data[‘XMLRESPONSE’][‘ITEM’]: print("key exist in JSON data") else: print("Key doesn’t exist in JSON data") input ("Press any key") …

Total answers: 1

JSON File update 2 values without break its structure or other values

JSON File update 2 values without break its structure or other values Question: Hello I have the next code to try to update a JSON file: with open(‘orderprepare.json’, ‘r’) as f: finalorder = json.load(f) finalorder[‘ItemList’][‘Quantity’] = 500 with open(‘orderprepare.json’, ‘w’) as f: json.dump(finalorder, f) But it shows the error “finalorder[‘ItemList’][‘Quantity’] = 500 TypeError: list indices …

Total answers: 2

PyList_GetItem() returning a reference

PyList_GetItem() returning a reference Question: I am using the PyHelper class that I found HERE My python script is returning a list and in C++ I can call PyList_Size() and successfully get the size but when I try get item it returns a very large number which I assume is a address reference rather than …

Total answers: 1

Get a element from list, from pair of 3

Get a element from list, from pair of 3 Question: Hello I have a list in which elemnets are in pair of 3 list given below, labels = [”, ”, ‘5000’,”, ‘2’, ”,”, ”, ‘1000’,’mm-dd-yy’, ”, ”,”, ”, ’15’,’dd/mm/yy’, ”, ”, ”, ‘3’, ”,”, ”, ‘200’,”, ‘2’, ”,’mm-dd-yy’, ”, ”,”, ”, ”,”, ”, ”] in …

Total answers: 3