text
stringlengths
226
34.5k
reading cookies file created by curl Question: I have the following cookie saved by curl (in test.txt, tab-separated, this editor doesn't preserve tabs): # Netscape HTTP Cookie File # http://curlm.haxx.se/rfc/cookie_spec.html # This file was generated by libcurl! Edit at your own risk. #...
GNU Parallel to run Python script on huge file Question: I have a file which contains XML elements in every line, which needs to be converted to JSON. I have written a Python script which does the conversion but runs in serial mode. I have two options to use Hadoop or GNU Parallel, I have tried Hadoop and want to see h...
simpy 2.2 examples in 3.0 Question: I am trying to work through some of the examples of simpy 2.2 (see: <https://pythonhosted.org/SimPy/Tutorials/TheBank2OO.html>) and rewrite them using simpy 3.0 lexicon (see: <http://simpy.readthedocs.io/en/latest/about/history.html>). Has anybody came across the the following exampl...
How would I take an excel file and convert its columns into lists in Python? Question: I had the following question. Namely, suppose I have an excel file with some names in the first row. Then the next however many rows are single letter entries (so "A", "B", "C" and so on). My goal is to extract the column and make i...
MongoDB: mongoimport isodate on Ubuntu 14.04LTS Question: Platform: Ubuntu 14.04 LTS 64bit Python installed, can't remember its version right now: I can update this question later ....$>sudo mongod --versiondb version v2.4.9 git git version: nogitversion ....$>sudo service mongodb stat...
Error when pip installing CRFsuite in Python 3 Windows 10 x86 Question: I'm trying to install [CRFsuite](https://python- crfsuite.readthedocs.io/en/latest/) to my Python 3 based on Windows 10 x86 while an Error occured, please see below. At start, it was missing `vcvars32.bat` but I managed to solve it by installing _M...
python - Django : Page Not found Question: I have looked around and can't really find a solution to my problem. Here is the error django throws. This error is being thrown when on my homepage I have a fiew links that upon clicking should direct you to a details view of said link. Using the URLconf define...
numpy.dtype error in machine learning code (Python) Question: I am just trying to run a scikit-learn example source code successfully, but am getting an consistent error. The code can be found [here](http://scikit- learn.org/stable/auto_examples/covariance/plot_outlier_detection.html) \- it has around 90 lines of code,...
opencv2 Aruco library modules not working with python Question: I have compiled the aruco library as stated here [github link for aurco library](https://github.com/fehlfarbe/python-aruco) I have checked it has compiled successfully as i can import it in python without any error and to check i have run the example.py s...
Python tkinter: Using a "textvariable" in a combobox seems useless Question: Using the `textvariable` attribute when creating a combobox in tkinter seems completely useless. Can someone please explain what the purpose is? I looked in the Tcl documentation and it says `textvariable` is used to set a default value, but i...
python maya, function call 2 functions, force to run both Question: I made a windowUI with a button to run 2 functions so I defined a new function to run the other 2 def addSlider_splitLoop(): addSlider() splitLoop() mc.button(label ='Combo' , command = 'addSlider_splitLoop()' ) ...
Cannot merge .txt files having different encoding in Python Question: I'm trying to merge a number of .txt files into one file. Some of the files are plain text .txt files I created in advance, while some are files written by the script itself. The script successfully merges some of the files (the ones I wrote in advan...
How to mock stompest send, and connect methods Question: I am writing a log handler for `ActiveMQ`. I have one class, `Messenger`, to publish a message to `ActiveMQ`. Also, I added class `Handler` to handle this and `get_logger` to get this logger. import json import logging from stompest.co...
How to pre-process source files while a Sphinx run? Question: I have set up a Sphinx documentation for my project and would like to extract doc strings for the source files and embed them into the final documentation. Unfortunately, the source file's language (VHDL) is not supported by Sphinx. There seems to be no Sphi...
How do I secure an AWS API Gateway with Cognito? Question: I've setup an Identity pool and using Python and boto3 I'm able to retrieve an access key, secret key and session token, which I assume is for an unauthenticated user: import boto3 boto3.setup_default_session(region_name='us-east-1') iden...
Beginners Python: Regex & Phone Numbers Question: Working my way through a beginners Python book and there's two fairly simple things I don't understand, and was hoping someone here might be able to help. The example in the book uses regular expressions to take in email addresses and phone numbers from a clipboard and...
AttributeError: 'NoneType' object has no attribute 'lower' in python 3.4 Question: Code: import requests from bs4 import BeautifulSoup import operator def start(url): word_list =[] source_code =requests.get(url).text soup = BeautifulSoup(source_code) for post_s...
ipython notebook - memories disappear after running some function Question: After runing some (imported) function that returns a variable, say X. The memory usage increases much more than the size of X. And even I `del X` or all variables by `%reest`. The memory usage is still much larger than before running the functi...
Python Search text file & replace Question: I want to take a list of words from textfile1.txt and replace the word "example" on textfile2.txt to whatever the text is on line one, line two and so on.. How would I do this? Text file textfile1.txt user1 user2 user3 user4 user5 Text fi...
PyInstaller error with PySide Question: I have been playing with PyInstaller on Windows 7 (64 bit). I am currently using PyInstaller 3.1.1 with Python 2.7.6. I created an app that creates a simple PySide GUI and generated a dist folder with an executable with this command: > C:\Python27\Scripts\pyinstall...
How to select the following specific XML nodes using XPath? Question: I have an XML doc like the following: <Objects> <object distName="a/b"> </object> <object distName="a/b/c1"> </object> <object distName="a/b/c4/d/e"> </object> <object distName="a/b/c2"> </object> <obj...
How to I modify an external list? Question: I'm trying to code this thing in python, and I have bumped into a road block. I have this list, and I want to modify it, and keep the changes after the program is exited. I have no clue where to start. Essentially, I want a list that can be accessed and modified, and will be...
Plot Cumulative Distribution Function from shape, scale, and location parameters Question: After applying Generalised Extreme Value (GEV) theory I have a shape, location, and scale parameter to describe my distribution. Now I'm trying to plot a CDF with these three parameters in Python. In matlab there's a ["cdf" funct...
How to load lists in pelilcanconf.py from external file Question: There are different lists available in pelicanconf.py such as SOCIAL = (('Facebook','www.facebook.com'),) LINKS = etc. I want to manage these content and create my own lists by loading these values from an external file which c...
gem5 simulation time is high Question: good day every body I have a real problem here that took a near of couple weeks on searching but without a conclusion I'm trying to run a compiled c++ code (a binary file) on gem5 to measure the time consumed for some architectures I made using python and make my compare...
Python object instantiation from within another object - is it a memory leak? Question: Consider the following small Python GUI program, where the user can click a button over and over to cycle between window 1 and window 2: import tkinter class Window1: def __init__(self, parent): ...
Python flask and restless - how to return gz file of json object Question: I I am using flask-restless. I am trying to respond of a get request of a gz file of a json object from s3 and do not understand how to send a gz file. class report_download(Resource): def get(self,report_name): ...
Parsing IMDB with BeautifulSoup Question: I've stripped the following code from IMDB's mobile site using BeautifulSoup, with Python 2.7. I want to create a separate object for the episode number '1', title 'Winter is Coming', and IMDB score '8.9'. Can't seem to figure out how to split apart the episode number and the ...
Why isn't my WeakSet empty after deleting the only other reference? Question: I decided I should familiarize myself with the [`weakref` library](https://docs.python.org/3/library/weakref.html), so I started messing around with the collections, thought I was getting the hang of it until this. >>> import w...
Importing modules from different directories Question: What is the pythonic way for absolute importing modules located in different directories in Python 3? I am able to import modules by modifying the `sys.path` but that method is hackey. The alternative method, from what I've read, is to turn the project into a pip ...
how to make a tkinter window not resizable? Question: i need a tkinter (python) script to me static (not resizeable) i have a pretty simple tkinter script but i don't want i to be reasizeable like some kind of error message. i honestly don't know what to do this is my script: from tkinter import * ...
Disable a Tkinter button when variables are at 0 Question: I'm learning python still so the rest of my code may be flawed but my main problem is I cant disable this button when the Wood and Stone variable are at 0. I've tried using a while statement that runs the _button.config(state=DISABLED)_ command when _stone > 0 ...
dataframe change size and the convert to panel python Question: I have a question on how to change dataframe to a panel while changinig the dimensions of the dataframe. Originally I have a data frame with 2000 rows and 784 colmuns: data=pd.DataFrame(np.random.randn(2000,784)) data.shape (2000, 78...
ProgrammingError: column "column" of relation "schema" does not exist Question: I'm following this tutorial about using Scrapy with Postgres <http://newcoder.io/scrape>. I'm new with postgres and very familiar with scrapy. Nowhere in the tutorial does it state anything about migrations so I think it intends to generat...
How to convert CSV to nested JSON(upto level 3) in Python Question: I'm having the following data in CSV format. id,category,sub_category,sub_category_type,count 0,fruits,citrus,lemon,30 1,fruits,citrus,lemon,40 2,fruits,citrus,lemon,50 3,fruits,citrus,grapefruit,20 4,fruits,citrus,or...
String format python Question: I'm trying to clean up a bad solution. I have a utils file, which contains some generic methods and a commands file, where I store a list of commands to use within the program. However, when trying to clean up files by using string format, I'm starting to run into problems. ...
golang: read file generator Question: I'm learning _go_ language and try to rewrite some of my Python code using golang. I wrote a generator function that reads a text file line by line and send (using _yield_ keyword) only "valid" lines (blank lines are ignored, uncompleted lines are recomposed). Sample file (myfile....
python help! invalid literal for int() with base 10: Question: hi currently doing a code where the programe recalls two files one with positions of words the other words the following code combines them however when i change my code to be imported from a file i get the following error (if compressed_sentence[(int(i)-1)...
Why can I import module bs4 or requests from python IDLE shell but not from the python interpreter? Question: I can import module BeautifulSoup or requests without any problem when I run it from my script or do it directly in the python IDLE shell: Python 2.7.9 (default, Mar 8 2015, 00:52:26) [GCC ...
Python inheritance dilemma for plugin Question: _Although this question is in the context of a Sublime Text plugin, it is actually a question about Python object orientated design._ Writing a Sublime Text plugin which contains 2 complimentary commands (with some shared functionality) has led me to a Python inheritance...
is it possible to restart the already terminated process in python multiprocessing? Question: Here is the example code for my question: import multiprocessing, time def nopr(): i=0 while 1: i = i+1 print i time.sleep(...
Live update image while using socketio Question: I'm using python to push every nth image from a scientific camera to a web page. The webpage updates the image using `.replace()`. It's probably important to note that this is not a webcam - it's a scientific cam. I'm using the developer software to save an image to the ...
running unittests \ integration tests in python Question: I have a Django project with multiple apps. Each app has a set of unittests. I'm using pytest as my test runner. We have gotten to a point that we want to start writing integration tests. I was wondering if there is any way to keep the naming convention and thus...
Send MySQL blob content as a json response Question: I have the following code of a GET method which takes a photo which is stored in a blob type field in MySql and return. I want to return it to the client inside a JSON string in a type it can display the image in an angularjs application. def GET(self...
Python JSON Iteration into a POST request Question: I have a JSON file that is formatted something like { "unknown1": [ {"text": "random text again", "time": "Thu May 15 19:21:59 +0000 2016"}, "text": "akmfkdlm safsa fasffalmfa", "time": "Th...
gaierror: [Errno 11004] getaddrinfo failed Question: I hope to access the text file from the following url: <http://www.pythonlearn.com/code/intro-short.txt> My code is import socket socket.getaddrinfo('127.0.0.1', 8080) mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mysock...
Using reduce, map or other function to avoid for loops in python Question: I have a program working for calculating the distance and then apply the k-means algorithm. I tested on a small list and it's working fine and fast, however, my original list is very big (>5000), so it's taking forever and I ended it up terminat...
How can I use Theano with GPU on Ubuntu 16.04? Question: I use the following script to test if GPU is working: #!/usr/bin/env python from theano import function, config, shared, sandbox import theano.tensor as T import numpy import time vlen = 10 * 30 * 768 # 10 x #cores x # thr...
Functional/idiomatic way to express this Python in Clojure Question: I have a data transformation that is leaving me a bit stymied. I wasn't able to express myself in Clojure and even my Python, that I'm fluent in, still feels quite gross. I need a data structure like: [1, 2, [3, 4], 5, 6] to gene...
What arguments are available for the Python Tk() constructor? Question: I'm trying to make a python tkinter application and I'm having a lot of trouble finding a list of what arguments are available for creating a `Tk` object. example: from tkinter import * root = Tk(<args>) root.mainloop() ...
Matplotlib: how to add a base image to a 3D plot? Question: This topic has been touched [here](http://stackoverflow.com/questions/23785408/3d-cartopy-similar-to- matplotlib-basemap), but no indications were given as to how to create a 3D plot and insert an image in the `(x,y)` plane, at a specified `z` height. So to c...
Anaconda + Spark - changing python version for ipython notebooks Question: I installed Anaconda, and try to work with spark on top. When I launch spark with Ipython_OPTS="notebook", the python version is the one associated with anaconda's version of python for the notebook. $ conda search python Usin...
passing arguments to python script from command line Question: I am really new to python and pandas, I am trying to execute a python script using arguments in the command line but I got an error, here is my script #!/usr/bin/python import sys, pandas as pd df1 = pd.read_table(sys.argv[0],...
ReviewBoard pip installation failure Question: I am trying to install ReviewBoard on 14.04.1-Ubuntu and I get the error below. I have used commands: sudo apt-get install python-setuptools python-dev memcached patch libjpeg-dev sudo pip install -U pip sudo easy_install pip sudo apt-get install...
Import working in console but not in pyCharm Question: I had a python project with a lot of imports like: from src.main.fr.some.module import someclass and it was working good but my colleagues wanted the imports to be like: from fr.some.module import someclass Then I changed t...
Sorting a list of IPv4Network and IPv6Network objects Question: I have a list of IPv4 and IPv6 networks created with [`ipaddress.ip_network()`](https://docs.python.org/3/library/ipaddress.html#ipaddress.ip_network), which I want to sort (by family first, then value). What would be the best way to do this? Apparently, a...
How do I use variables created in venv bash in my django app? Question: If I create a variable in my venv like this DJANGO_SERVER_TYPE=local and on heroku I have DJANGO_SERVER_TYPE=production why won't my system recognize this from .base import * import os ...
How to find probability distribution and parameters for real data? (Python 3) Question: I have a dataset from `sklearn` and I plotted the distribution of the `load_diabetes.target` data (i.e. the values of the regression that the `load_diabetes.data` are used to predict). _I used this because it has the fewest number ...
Python IRC ChatBot hangs on socket.recv after seemingly random time even though socket.settimeout is 8 Question: Hey so I decided to create an IRC ChatBot whose sole purpose it is to read incoming messages from Twitch Chat and if a giveaway is recognized by a keyword it's supposed to enter the giveaway by sending !ente...
Can you tell me why this web scraper isn't able to log in correctly? Question: I'm trying to make a web scraper to get some information from the site Colloquy.com, on which I have an account. I am having trouble getting my scraper to log in to the site though. I'm using Python 2.7 with BeautifulSoup and Requests. [Her...
How to use an existing Environment variable in subprocess.Popen() Question: **Scenario** In my python script I need to run an executable file as a subprocess with x number of command line parameters which the executable is expecting. Example: * EG 1: myexec.sh param1 param2 * EG 2: myexec.sh param1 $MYPARAMVAL ...
When using Oracle JDK 1.8.0_60 on two centos 7.1 systems one Jenkins slave fails to collect artifacts with NoClassDefFoundError Question: Riddle me this: How can two nearly identical jenkins slaves running with Oracle JDK 1.8 u60 Java have one fail to collect artifact with a classdef error while the other is fine? In ...
How to find the raw header of a website using python? Question: I'm learning something about the website by myself. and I'm trying to fetch the raw header followed by the 3-digit HTTP return code from a website. Here is what I did so far: import urllib.request with urllib.request.urlopen('https://www...
How to make statement `import datetime` bind the datetime type instead of the datetime module? Question: After one too many times having accidentally typed `import datetime` when what was really needed was `from datetime import datetime`, I wondered whether it was possible to hack around and make the former do the latt...
Converting a numpy.ndarray value from bytes to float Question: I'm using numpy and Python 3.4 to read data from a .csv file. Here is a sample of the CSV file: "05/27/2016 09:45:37.816","187666432","7921470.8554087048","0","95.202655176457412","82.717061054954783","1.4626657999999999","158","5" "05/2...
How to apply math operations to a row of a csv in python? Question: I've been successful creating functions in python and reading/writing files. However, I really need to apply certain functions to whole **rows** of data (**not columns**) and can't find out anything about how to do this. The goals are: * Read a csv ...
Why am I getting an out of index error on my matrix? Question: I'm currently trying to make code for a game, the game is a lot like checkers. I'm representing my board as a 10 x 10 matrix. There exist two ways of moving in this game, you can do a step where you check all the positions adjacent to you and if any of them...
Traceback(most recent call last): error Question: I'm new to python and I'm writing a practice script that generates a random number between 1 and 20, asks you to guess the number until you get it right and then prints the amount of guesses once you get it right. The code all works until I get the last number then I ge...
Python - Retrieve and replace based on a regex Question: Basically I've imported a csv of about 17000 rows into a pandas dataframe. There is a date column that has been imported as `int64` because data quality is very poor. Examples of dates include `11969`, `12132001`, `1022013`, etc. So I figure what I want to do is ...
Python find index of all dates between two dates Question: I am trying to implement equivalent of `numpy.where` for dates as follows: from datetime import date, timedelta as td, datetime d1 = datetime.strptime('1/1/1995', "%m/%d/%Y") d2 = datetime.strptime('12/31/2015', "%m/%d/%Y") AllDa...
Attribute system similar to HTTP Headers for local files Question: I am in the process of writing a program and need some guidance. Essentially, I am trying to determine if a file has some marker or flag attached to it. Sort of like the attributes for a HTTP Header. If such a marker exists, that file will be manipulat...
How to read some contents of xml files and write them into a text file? Question: I have a following xml file, I want to read the contents in `<seg>` and save them into a plain text file with Python. And I used the DOM module. <?xml version="1.0"?> <mteval> <tstset setid="default" srclang="an...
Why simple import of module in same directory is not allowed Question: I've created two modules in the same directory: . ├── mod1.py ├── mod2.py There is no `__init__.py`, I don't want to create this as a package, I'm just creating a simple script which I have modularized by breaking into d...
Tensorflow crashes when using sess.run() Question: I'm using tensorflow 0.8.0 with Python v2.7. My IDE is PyCharm and my os is Linux Ubuntu 14.04 I'm noticing that the following code causes my computer to freeze and/or crash: # you will need these files! # https://www.kaggle.com/c/digit-recognizer/d...
How to make a correct HTTP Post request with Meteor.js to Domino Datalab's Rest API Question: In my server side Meteor.js method, I'm trying to correctly make a request to Domino Data Lab's (DDL) Rest API. DDL provides a platform for makes it possible to call a data science model via a REST API. Their documentation on...
'utf-8' codec can't decode byte 0x80 in position 0 Question: Ok when i'm in django I can run the website by the following command. `sudo python manage.py runserver` But when I try and use the greed arrow for running the project is gives me like a dozen errors. This happens straight away when i set up the project and...
User Defined Array formulas in DataNitro Question: I have created a python function to exponentiate a matrix and imported it as a user defined function in Excel using DataNitro. However, when I use this formula I get the result as a python list in one cell. Is it possible to create array formulas for excel using DataN...
Error importing numpy & graphlab after installing ipython Question: I have got a strange issue. I am now using graphlab/numpy to develop a project via Pycharm 5. OS is Mac OS 10.11.5. I created a p2.7 virtual environment for the project. Programme runs well. But after I install ipython, I can no longer import graphlab...
Django ) Postgresql model ERROR Question: In models.py in my app of django, I have a model below : from django.db import models from django.contrib.postgres.fields import * class lkmModel(models.Model): #Profile Image profileUrls = ArrayField(base_field=models.TextField,...
FLASK - Running Python Scripts Question: I have made a webpage using bootstrap which is hosted on a raspberry pi. What I would like to do is to, when a certain button is clicked, is to run a python script. This is all being hosted/run/accessed through a FLASK hosting service. Thank you for your time. Answer: [Run py...
No module named flask in virtualenv although installed Question: I want to use Flask to develop a website but I am having already problems getting a simple demo app running. I followed the complete installation tutorial of [the flask website](http://flask.pocoo.org/docs/) Means: * I created a project directory. ...
Tkinter, custom widget and label updates Question: **Description** I want to make a custom `"Table Widget"` for Tkinter and so far it's almost as I want. The problem I have is that I want the table to consist of `"Labels"`, I have only found that you have to use `"StringVar()'s"` in order to update the labels. I don...
event handling of balloon tip with win32gui Question: I'm currently using a slightly modified version of the [common example of the systemtray](http://www.brunningonline.net/simon/blog/archives/SysTrayIcon.py.html). #!/usr/bin/env python # Module : SysTrayIcon.py # Synopsis : Windows System...
How can I replace Unicode characters with Turkish characters in a text file with Python Question: I am working on Twitter. I got data from Twitter with Stream API and the result of app is JSON file. I wrote tweets data in a text file and now I see Unicode characters instead of Turkish characters. I don't want to do fin...
pysftp connection to host with pem file raise exception paramiko.ssh_exception.BadAuthenticationType Question: I have to connect to other server in python using the pysftp library, the target server had a key value pair file (pem file), and I've got the following exception: paramiko.ssh_exception.BadAuth...
regex backreference findall not working python Question: I have recently been using regexes in a program. In this program I used them to find words in a list of words that matched a certain RE. However, when i tried backreferencing with this program, I got an interesting result. Here is the code: import...
Selenium on Anaconda 2 not opening firefox Question: I'm a beginner python user and try to use selenium to open Firefox on Win 10 and Anaconda 2.5. I just downloaded Firefox and installed selenium on Anaconda, so they are up to date. When I type the following: from selenium import webdriver browser =...
Python Server socket.error: [Errno 92] Protocol not available Question: I wanted to make a server, that recives an command from a client, in the form of a String and send a String(or a List of Strings) back. The first time, I run the server and the client, it works perfectly fine, but after the server send the String t...
Getting an error when trying to create a virtual env Question: I want to learn django so I tried to create a virtual env and I am getting this error: mkvirtualenv djngo Traceback (most recent call last): File "/usr/local/bin/virtualenv", line 5, in <module> from pkg_resources impor...
How do I convert a dataframe consisting of a column of sentences and a column of scores into one with a column of words and average scores? Question: I have a Pandas dataframe that resembles this: sentence score "This is a sentence." 5 "Another sentence?" 8 And I want one tha...
how to get the unique combination of columns and sort by them in python data frame? Question: how to get the unique combination of columns and sort by them in python data frame? I know I can use df.groupby(['col1','col2']).size() to get the unique combination. However, I also want to have the result order by the ascend...
How to scrape data from html which does not belong to any tag Question: I want to scrape country name and date from the below website html example. Here the name of the country and date are not inside any tag but just free data. How to scrape it? <div class="infos"> <p> <span class="hidden-xs hid...
Set zlim in matplotlib scatter3d Question: I have three lists xs, ys, zs of data points in Python and I am trying to create a 3d plot with `matplotlib` using the `scatter3d` method. import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111, projection='3d') plt.xlim...
Pygame loads images with RGB values offset 1px, but not alpha values Question: When attempting to load an image via Pygames image load functionality, a black bar appears at the top of the loaded image. When slicing the tiles it became apparent that this bar offset the content by 1px. Attempting various file formats (g...
Regex Multline Python Question: i am currently trying to do a regex on pyhthon that should match multline. ([0-9]{2}\.[0-9]{2}\.[0-9]{4}\s[0-9]{2}:[0-9]{2}:[0-9]{2}).*?\r\n-{1,}\sFG\s{3,}?4 is my regular expression, this is my python call re.findall("([0-9]{2}\.[0-9]{2}\.[0-9]{4}\s[0...
Error while importing matplotlib.pyplot Python Question: I have a problem while importing matplotlib.pyplot , I have python2.7 windows 7 64bits >>> import matplotlib.pyplot as plt Traceback (most recent call last): File "<pyshell#16>", line 1, in <module> import matplotlib.pyplot a...
Sorting data from a table Question: I'm working on a new version of a module and I need to create a new table for that, but I'm facing a little issue that is driving me crazy. Here is my relevant python code: import psycopg2, sys, psycopg2.extras, time order = 4419 try: con = p...
How to download a specific file type from all subdirectories of an FTP server? Question: I am trying to download all `.laz` files from the FTP host `gis.arkansas.gov` (more details [here](http://gis.arkansas.gov/?page_id=7813)). Looking at the [`ftplib`](https://docs.python.org/2.7/library/ftplib.html) documentation, I...
Python: interpreter says "None" after parsing file Question: I've written a simple interpreter with Python for a programming language I've created. I have a little problem though: when I try to read a file, so the code can be interpreted, Python says `None`. Here's the interpreter code: import sys ...
Mock urlilb+json in Python Question: looking for a way to correctly mock this piece of code: import json from urllib import urlopen a_url = "http://blabla" my_response= urlopen(a_url) a_dict = json.loads(my_response.read()) It reads from an URL, then the response uses json.load...