Where is Python's sys.path initialized from?

Where is Python's sys.path initialized from? UPD: Python is adding some paths before refering to PYTHONPATH: >>> import sys >>> from pprint import pprint as p >>> p(sys.path) ['', ...

Getting python string into json format

I hope there is a guru here to help me. I am a journalist and quickly threw together some Python code to grab tweets on a huge story here in South Africa and store them in an sqlite database for...

JSON encoding from python objects?

I know there are several questions and answers about this, but I can't be really sure any of those will help me. So this is my case, I'm using sympy library and a very few numpy functions too. I...

cannot print content of python dictionary

I want to print the content of Python dictionary which is converted from JSON Object . I am unable to do that . Please help me , i don't know whats going wrong . Edit : Please put some light why...

How to fix JSON invalid control character errors?

FWIW, I have used other JSON APIs without issue (Tumblr, Twitter, etc.). My Google Blogger Client uses Google's Blogger API so I can do things such as download blog posts from a user, or download...

How do I use npm to install and run packages?

I am attempting to use npm to install a json validator (jsonlint). I installed npm using the package manager: sudo apt-get install npm Then I tried to install jsonlint using the command sudo...

How to automatically parse damaged JSON documents?

I have over 3,000 JSON documents stored in truncated text files. Those documents cannot be recovered from the original source, the data is gone. I tried json, simplejson, and demjson to turn them...

How to plot a histogram

My program imports these: import requests import demjson import pandas as pd from pandas import DataFrame import pylab pylab.show() I have a dataframe which if I print out looks like this: ...

jsonpickle and float decoding (demjson)

How can I set the jsonpickle such that all floats are decoded as floats and not decimal.Decimals: import jsonpickle import...

Could not find a version that satisfies the requirement springpython==1.2.1.FINAL

I'm suddenly getting this error when I try to run pip install -r requirements.txt: Could not find a version that satisfies the requirement springpython==1.2.1.FINAL (from -r requirements.txt (line...

Python Scrapy getting an error JSONDecodeError: Values must be separated by a comma while decoding the json string

I am trying to decode the json string using demjson library and i am getting an error - "JSONDecodeError: Values must be separated by a comma". I am scrapping a website using the python scrapy...

Getting KeyError: in my Python script

I am trying to build script which will download images using Python. I am having a problem in the code as the keyerror in Python v 2.7.11 is occurring. My code is import urllib, urllib2, demjson,...

Using python to modify format of Json file

I have JSON file that is formatted like this: (multi-line for clarity) (line 0001)....... { "_id": "iD_0001", "skills": [{ "name": "Project Management" }, { "name":...

python unittest fails running all testMethods, while each testMethod runs well

I'm using PYCharm and unittest in python to test my Classes. Running each testMethod one by one and all tests are passing well. Running all tests together it fails with assertionErrors. The setup...

Why the single quotes cannot be removed in this Python code?

I find below code from internet and run it correctly. #!/usr/bin/python import demjson json = '{"a":1,"b":2,"c":3,"d":4,"e":5}'; text = demjson.decode(json) print text The result is...

How to specify dependencies using setuptools?

My setupfile setup( name = 'arkan', version = '1.0a', packages=find_packages(exclude=["contrib", "docs", "test*"]), install_requires=['demjson', 'simplejson', 'pytz', 'datetime',...

JSON serialization and deserialization within a function callback in python

Let's say for example that I have code like the one below: def function_callback(cb): cb() def rand_name_giving_func(i): list_test = ['john', 'jim', 'anna', 'cynthia', 'dwight'] ...

Webscraper, extract list to .json?

I am trying to scrape a website (www.cashpoint.dk) for odds and other relevant information. Can someone help me with what to do if I want to extract the output of print((bet['team1'],...

Convert str to dict

I know this question has already been asked and answered and i tried some of them but none worked in my project json.load/json.load/ast/demjson all give me error in file: file = open("C:/Users/" +...

Extracting variables from Javascript inside HTML

I need all the lines which contains the text '.mp4'. The Html file has no tag! My code: import urllib.request import demjson url = ('https://myurl') content =...

Why can't I read csv file in PyCharm?

I read some other threads here at stack and one of them is that you don't need to install csv, but when I import csv module, "from cvs import *" is grey coloured. When you import it in your code...

Using python, how can I check if a string is a valid json object, even if the string uses single quotes?

Let's say I have a string that looks like this: "{'apple': 1, 'orange': 2}" How can I determine if this is a valid json object? json.loads() doesn't work because the string uses single quotes...

Can the Deep security API (through the new DSaaS SDK) be used to send the "upgrade Agent" instruction to a computer?

I'm Using the Python SDK. I would like to use the DeepSecurity API to send to a computer the instruction to upgrade an agent. The same that you would do on the console by "right-click computer ->...

Parsing unicode with keys without double quotes in python

I'm trying to convert the below python unicode object without double quotes to json. x = { version: '2.1.2', dipa: '1.2.3.4', dipaType: '', customerInfo: [{ name: 'xyz', ...

How do I make Open CV work on deployed web app

I have an application that I can run locally and have it open my web camera then detect a qr code. It works well when I run the app locally but then I used the app on my web server and it gets a...