text
stringlengths
226
34.5k
write two values to csv row in python Question: So I have a solved problem, but I don't like the solution :) with open(outfile, 'a') as file: writer = csv.writer(file) #opens a csv writer #inserts ID to front of wordList wordList.insert(0,ID) writer.writerow(wordList) ...
how to enable transparency in vte.Terminal Question: i am creating a simple terminal in python using vte.Terminal. i want to have a certain level of transparency in the terminal background but the set_opacity doesn't work. but it works in terminator and other terminals. window.set_opacity makes the whole window transp...
Inconsistent MySQL information using django data models Question: I've been grappling with what appears to be a bug between Django/MySQL, but is perhaps just my own misunderstanding in the nuances of threaded applications, etc. First, a bit of information on my application. I have a multithreaded application programme...
Twisted adbapi errors and log.err Question: I'm debugging the 'MySQL server has gone away' errors. There is a proposed solution, which more or less works: from twisted.enterprise import adbapi from twisted.python import log import MySQLdb class ReconnectingConnectionPool(adbapi.Connectio...
python byRef // copy Question: I am new to Python (and dont know much about programming anyway), but I remember reading that python generally does not copy values so any statement a = b makes b point to a. If I run a = 1 b = a a = 2 print(b) gives the result 1. Should that not be 2? A...
Why won't .png files download with Python script while it works for other image types? Question: I am trying to search the source code of a webpage, and download various files from it using Python. This script searches the source code for .jpg files and downloads them all as expected. However, upon modifying the script...
Reinforcement learning methodes that map continuous to continuous Question: I am building a model where firms have to set prices and make production decisions. Prices are continuous and so are the decision variables. (inventory, last sales, prices...). What reinforcement learning method can I use that maps continuous ...
Two Python modules require each other's contents - can that work? Question: I have a Bottle webserver module with the following line: from foobar.formtools import auto_process_form_insert And the `foobar.formtools` module contains this line: from foobar.webserver import redirect, red...
import django models classes into utility module Question: I have two model classes in my models.py module in the default location. PythonFinal |_ manage.py |_ template |_ PythonFinal | |_ __init__.py | |_ settings.py | |_ urls.py ...
Requests Module Python Question: I have an application running with PHP and CURL. My idea is to move the application to Python-Django-Requests. I have been unable to work, I hope you can give me a hand please. The application works as follows: Collect: a number, a message and through an API sends an SMS. PHP code. <ht...
Error in trying to open dialog box from a widget button in python Question: I'm new to python. I'm trying to open a dialog box to get a value from within a widget that does a list of other staff allready. But getting errors and can't figure out what to do. Here's my code: import Tkinter,Tkconstants,tkF...
Python: BeautifulSoup extract text from anchor tag Question: I want to extract text from following src of the image tag and text of the anchor tag which is inside the div class data. I successfully manage to extract the img src but I am having trouble on extracting the text from the anchor tag. <a class...
Installing IPython for Sublime Text 2's embedded Python interpreter Question: I am trying to install the IpythonIntegration package in sublime, I installed in a bash shell: 1. the latest ipython 2. pyzmq 3. pyside However, the sublime console still gives me an error of Reloading plugin /home/are...
Emacs24 + Pymacs -f switch with pymacs-load-path redundant? Question: I've upgraded to Emacs24 and, when launching Pymacs it would break because of timeout. Below is the backtrace: Debugger entered--Lisp error: (error "Pymacs helper did not start within 30 seconds") signal(error ("Pymacs helper di...
HTTPResponse instance has no attribute 'status_code' in python/django Question: I have used python httplib to implement REST api to connect with Django tastypie. But whenever i try to get the status code it is showing following error AttributeError at /actions/login HTTPResponse instance has no attri...
strict match anywhere in line regex python Question: I need to strictly find line `createNode transform -n "bar1_1" -p "bar1";` in a file that has many such lines ... createNode transform -n "pTorus1"; setAttr ".t" -type "double3" -0.47688973199150198 0 -10.843417358550912 ; createNode t...
Avoiding TypeError when using timedelta to compare times Question: I have a nested list containing times and some corresponding information, and am trying to extract one line from the start of a block of times that follow on from each other by a second (e.g. 10:04:23,10:04:24,10:04:25..). There should be a lot of these...
Concatenating Multiple .fasta Files Question: I'm trying to concatenate hundreds of .fasta files into a single, large fasta file containing all of the sequences. I haven't found a specific method to accomplish this in the forums. I did come across this code from <http://zientzilaria.heroku.com/blog/2007/10/29/merging-s...
django CLI script and database router: cannot import name connections Question: I made a database ruter for `myapp` application in file `/myproject/myapp/routers.py` class ShardingRouter(object): def db_for_read(self, model, **hints): return 'default' def db_for_writ...
Having trouble setting java.library.path for Jython Question: I'm working with some legacy code at work. Trying to run on of the python scripts in our code via Jython, I'm getting an UnsatisfiedLinkError. I've tried to use the "-D" option to set the java.class.path option, but it doesn't seem to resolve things. For the...
Get output when username is asked on msysgit in Python (on windows) Question: I'm trying to get the output when doing a git fetch, but it's halting asking for the user name and I'm unable to detect that. I.e.: In a Python script I'm doing: cmd = 'git fetch origin master'.split() import subprocess ...
How to open and search a file in a telnet session with Python Question: I'm using the following code to log into a server and go to a particular directory (where the logfile I want to search for a string resides). I have accomplished this with the Paramiko module (ssh), fairly straightforward. But the telnetlib module ...
Python- bottle - cookies keep changing Question: Below is my code for setting and reading cookies in bottle. if request.get_cookie('mycookiename'): cookie_id = request.get_cookie('mycookiename') else: cookie_id=str(uuid4()) response.set_cookie('mycookiename', c...
ElementTree: What is the syntax for the 'match' argument to the 'find' method? Question: The official documentation [here](http://docs.python.org/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.find) just says, "match may be a tag name or path", but I don't see a definition of "path" anywhere. From loo...
Problems with deploying flask WSGI application on apache2 Question: I created a one file Flask app so I can test how to deploy it on apache2 server. I followed the steps on the [Flask](http://flask.pocoo.org/docs/deploying/mod_wsgi/#installing-mod-wsgi) as far as the server and WSGI configuration goes. When I point to ...
"TypeError: 'module' object is not callable" when running with py.test under /test folder Question: I have a class `Foo` which lives in `Src/Projects/SomeProject/Foo.py` I have a class `FooTest(unittest.TestCase)` which lives in: Src/Projects/SomeProject/tests/FooTest.py When I run it with pytest ...
Fetch data in IE8 using pywin32 Question: * * * I've been trying to fetch data using pywin32(Internet Explorer) but can't find anything good, Basically I want to fetch the data from the current source of IE PAGE for example : if <http://whoer.net> is opened then I would like to fetch the country or if the country is t...
Python reading files in a directory Question: I have a .csv with 3000 rows of data in 2 columns like this: uc007ayl.1 ENSMUSG00000041439 uc009mkn.1 ENSMUSG00000031708 uc009mkn.1 ENSMUSG00000035491 In another folder I have a graphs with name like this: uc007csg.1_nt_counts....
Writing variables to a hex file in Python Question: So, I have got a float value: -1.0f, or something. And how could I write it into a file in hexadecimal format in Python? I mean that we open the file in notepad, we won't see the hexadecimal values, just the ASCII code. Answer: In Python 3: >>> import...
Sorting Python dictionary based on nested dictionary values Question: How do you sort a Python dictionary based on the inner value of a nested dictionary? For example, sort `mydict` below based on the value of `context`: mydict = { 'age': {'context': 2}, 'address': {'context': 4}, ...
Transform URL string into normal string in python (%20 to space etc) Question: Is there any way in python to transfrom this-> %CE%B1%CE%BB%20 into this: "αλ " which is its real representation? Thanks in advance! Answer: >>> import urllib2 >>> print urllib2.unquote("%CE%B1%CE%BB%20") αλ
Why does multiprocess.Process not write the file while threading.Thread does? Question: The dotestsrl and the dotestmt functions work, and they create and write to the files. The dotestmp function runs fast, but does not create nor write to the files. What can I do to make it so that dotestmp performs the same task as ...
Use a DLL with python (using ctypes), not working Question: I'm trying to write a DLL that I can import in Python (2.7), and I'm having difficulties "making it work". When I load the library in Python using `WinDLL()` or `windll.LoadLibrary()`, and test the exported function the output i get is empty. If I add an argum...
Lexical cast from string to type Question: Recently, I was trying to store and read information from files in Python, and came across a slight problem: I wanted to read type information from text files. Type casting from string to int or to float is quite efficient, but type casting from string to type seems to be anot...
Reliance Broadband Auto Login Script - Syntax Error When Running on Windows Question: I am using Reliance Broadband which has web based login for accessing internet. It gets log-off every 24hrs, so I have to sign in again. I came across a [PYTHON script](https://github.com/zyxware/reliance-auto- login-script), which k...
Python OpenCV Box2D Question: I am trying to call OpenCV function MinAreaRect2 from within python. I use OpenCV 2.4.2 with python 2.7 and numpy 1.6. I went this far : import cv def nda2ipl(arr, dtype=None): return cv.fromarray(np.ascontiguousarray(arr, dtype=dtype)) def min_area...
Tkinter GUI Python background color Question: I'm writing a Tkinter application with buttons, graphs, sliders, etc, but I can't get their background uniform. import Tkinter from Tkinter import * root =Tk() root.title('Button') root.configure(bg='gray') Button(text='Button',bg='gr...
How to wait for 20 secs for user to press any key? Question: How can I wait for user to press any key for 20 secs? I.e. I show the message and it counts 20 secs, the code continues execution either if 20 secs are passed OR if user pressed any key. How can I do it with python? Answer: If you're on Windows: ...
Why does this python dictionary get created out of order using setdefault()? Question: I'm just starting to play around with Python (VBA background). Why does this dictionary get created out of order? Shouldn't it be a:1, b:2...etc.? class Card: def county(self): c = 0 l = 0 g...
Python2.7 - Sqlite3 - 2 inputs Question: I am writing a small python script like this: #!/usr/bin/env python from sqlite3 import dbapi2 as sqlite from sys import argv,exit db_name = "hashez.db" def define_db(): try: conn = sqlite.connect(db_name) ...
Can python threads access variables in the namespace? Question: I have a script that creates a bunch of threads, runs a program to use the threads to run tasks from a queue, and returns something from each thread. I want to count how many of these returned successfully, so I set a variable "successful=0" and increment ...
Python 3, Scrypt module, Hashes Not Matching Question: Using: Python 3.2.3, scrypt 0.5.5 module, Ubuntu 12.04 I installed the scrypt module fine. I ran the sample code on the page fine. I also found an [expanded version of the sample code](http://aleccolocco.blogspot.com/2011/09/how-to-protect-passwords-with- python.h...
How to use pip to install lxml in different version of python? Question: In my os, `/usr/bin/python` is python2.6, and `/usr/local/bin/python` is python2.7. I have installed pip, however, when I use the command: pip install lxml I found I can use lxml in python2.7, but I can't use it in python2.6 ...
ImportError: No module named statsmodels Question: Hi I downloaded the StatsModels source from <http://pypi.python.org/pypi/statsmodels#downloads> I then untarred to /usr/local/lib/python2.7/dist-packages and per the documentation at <http://statsmodels.sourceforge.net/devel/install.html> did this ...
Python folder structure for larger projects Question: I'm new to using python for larger projects. I figured out following folder structure for my python project: project --> doc --> src --> hardware --> devices --> device1 --> dev...
Get function callers' information in python Question: I want to get information about the callers of a specific function in python. For example: class SomeClass(): def __init__(self, x): self.x = x def caller(self): return special_func(self.x) def special_...
How do I replace a specific part of a string in Python Question: As of now I am trying to scrape Good.is.The code as of now gives me the regular image(turn the if statement to True) but I want to higher res picture. I was wondering how I would replace a certain text so that I could download the high res picture. I want...
How do you find the similarity of tuples, as a fraction, in python? Question: For instance, if I had the tuples (1,2) and (3,2) in python, is there any way to have a program return 0.5 or 1/2? I've searched but haven't been able to find anything. Answer: >>> a = (1, 2) >>> b = (3, 2) >>> sum(x == y for x...
Custom Tags in Django 1.2 with Google App Engine Python 2.7 Question: Creating a custom tag in Google App Engine Python2.5 with Webapp used to be a joyful experience. Here: [Django Templates and variable attributes](http://stackoverflow.com/questions/35948/django-templates-and- variable-attributes) But now, in Python ...
Python, Sqlite not saving results on the file Question: I have this code in Python: conn = sqlite3.connect("people.db") cursor = conn.cursor() sql = 'create table if not exists people (id integer, name VARCHAR(255))' cursor.execute(sql) conn.commit() sql = 'insert into peopl...
PyDev PYTHONPATH does not work for separate test und src directories Question: This is probably a noob problem. For that I apologize, but I couldn't find a solution so far. I short, for some reason that I don't understand, I can't access modules from my `src` directory in my tests. My project setup looks like this: ...
Try to revisit the URL in javascript Question: I want to visit certain REST URI. $.ajax({ type: "POST", url: url + "result/" + ticket_id, success: function(data) { setTimeout(function(){pollResponse(url,data.id);}, 3000); } }); This works. It visits t...
Parallel running of several jobs in a python script Question: I am not a programmer and hence simple answers will be appreciated. I am a MD and am involved in a bioinformatics project. Let's say I have a Python script, `abc.py` and I have a text file, `commandline.txt` with 113 command lines, 1 in each line, for this ...
Installing and Running CGI Proxy Python on Tomcat 7 Question: I want to set up a proxy running on tomcat for openlayers, so I followed these steps: 1. Downloaded the proxy.cgi file from the OpenLayers web site: <http://trac.osgeo.org/openlayers/browser/trunk/openlayers/examples/proxy.cgi> Here is the code: ...
Why type('string') seems to return null string in python cgi Question: I'm reading Mark Lutz's _Programming Python 3rd editon_ , and I'm puzzled with a question: `type('something')` always result in an empty string. Could someone kindly explain this? Context info: I add one line to the script `$CODEROOT\pp3e\Interne...
How to arrange and set up unit testing in Python Question: I am working on a project in Python, using Git for version control, and I've decided it's time to add a couple of unit tests. However, I'm not sure about the best way to go about this. I have two main questions: which framework should I use and how should I ar...
Changing package install order in Python Question: Does anyone know if package install order matters in Python? More specifically my pip `requirements.txt` for a Django website I am building was: Django==1.4 MySQL-python==1.2.3 django-evolution==0.6.7 django-pagination==1.0.7 boto==2.5.2 ...
Cannot use HTMLUnit Webdriver from Python Question: I'm trying to use the HTMLUnit WebDriver from Python with the following code: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.webdriver.remote.webdriver import WebDriver if __name__ == '__main__'...
Can Python's selenium library play a test case saved as HTML Question: I'd like to be able to write a Django [LiveServerTestCase](https://docs.djangoproject.com/en/dev/topics/testing/?from=olddocs#django.test.LiveServerTestCase) which runs a Selenium test that has been saved as HTML using the Selenium IDE. The code mig...
Differences between functools.partial and a similar lambda? Question: In Python, suppose I have a function `f` that I want to pass around with some secondary arguments (assume for simplicity that it's just the first argument that remains variable). What are the differences between doing it these two ways (if any)? ...
Using StringIO for ConfigObj and Unicode Question: I am trying to use StringIO to feed ConfigObj. I would like to do this in my unit tests, so that I can mock config "files", on the fly, depending on what I want to test in the configuration objects. I have a whole bunch of things that I am taking care of in the config...
Is yield-based coroutine is REAL coroutine? Question: I was implementing greenlet API just for practicing. from greenlet import greenlet def test1(): print 12 gr2.switch() print 34 def test2(): print 56 gr1.switch() print 78 gr1 = ...
ImportError: No module named observers after installed watchdog Question: Im trying to run [official watchdog simple example](http://packages.python.org/watchdog/quickstart.html#a-simple-example) after installing the `watchdog` module using pip: `pip install watchdog`, and i get an error: from watchdog.o...
python subprocess set shell var. and then run command - how? Question: I need to do this: $ export PYRO_HMAC_KEY=123 $ python -m Pyro4.naming So, i found that the second one is possible to do with subprocess.Popen(['python','-m','Pyro4.naming']) but how export shell variabl...
Select all text in a textbox Selenium RC using Ctrl + A Question: I am trying to select all the text in a textbox in order to clear the textbox. I am using Ctrl+A to do this using the following Python 2.7 code on Selenium RC standalone 2.20.0.jar Server on Windows 7 firefox: from selenium import selenium...
undefined symbol: PyExc_ImportError when embedding Python in C Question: I'm developing a C shared library that makes a call to a python script. When I run the application I get this error: Traceback (most recent call last): File "/home/ubuntu/galaxy-es/lib/galaxy/earthsystem/gridftp_security/gridf...
How include static files to setuptools - python package Question: It's impossible to include static files! I tried everything that I've found in tutorials and the documentation, but all in vain... I want to include the ./static/data.txt, there is my code: # setup.py import os,glob from setuptool...
Spline Interpolation with Python Question: I wrote the following code to perform a spline interpolation: import numpy as np import scipy as sp x1 = [1., 0.88, 0.67, 0.50, 0.35, 0.27, 0.18, 0.11, 0.08, 0.04, 0.04, 0.02] y1 = [0., 13.99, 27.99, 41.98, 55.98, 69.97, 83.97, 97.97, 1...
python cross platform apps Question: I'm trying to make an app in CPython that should work on both linux and windows. I'm using the webkit library, witch works fine on linux (Ubuntu 12.04), but I can't get it to work on Windows. I know that I can compile my app into a Windows executable _(.exe)_ with `py2exe`, but to ...
Use opencv stitcher from python Question: OpenCV can be used with the pythonbindings and it works quite well. However I was wondering (hoping really) whether it is possible to use [OpenCv's stitcher](http://docs.opencv.org/modules/stitching/doc/stitching.html) in python as well. I've tried several things but wasn't abl...
How do I render jinja2 output to a file in Python instead of a Browser Question: I have a jinja2 template (.html file) that I want to render (replace the tokens with values from my py file). Instead of sending the rendered result to a browser, however, I want to write it to a new .html file. I would imagine the solutio...
Reverse AND inverse python3.x OrderedDict efficiently Question: After many attempts to create one-liners that will invert key-value pairs, and reverse an OrderedDict, I have this: from collections import OrderedDict as OD attributes=OD((('brand','asus'), ('os','linux'), ('processor','i5'...
traceroute multiple hosts in python Question: I'm writing a script to do traceroute for a list of hostnames. what I'm trying to do is reading hostname from a text file, line by line, performing tracert for each host using subprocess and writing the result in another file. here is my code # import sub...
Node frequency using networkx Question: I’m just learning python, so I appreciate the help. I have a two-column data set, the first is a unique id, and the second is a string of items. I’m using networkX to make a tree from the data (see below). I need to know the item frequency per level. For example, for the path in ...
Python object extension which gets a list in constructor never passes the creation step (SIGSEV), why? Question: I've been fighting for a lot of time with an error and I've run short of ideas on what's happening and why it doesn't work. First of all, I'm trying to create a new object type for Python through a C extens...
Filter xml data in Python Question: Please help, Python beginner, after getting all the data from xml, **data_list = xmlTree.findall('.//data')** e.g here I get 10 rows Now, I need to keep only a few rows for which attribute 'name' values match with elements of another list (inputID) with three IDs inside. e.g. remain...
Importing module from package Question: I am trying to import a module from a package set up as per instructions from [Modules Python Tutorial](http://docs.python.org/tutorial/modules.html). My directory tree is: $ pwd /home/me/lib/python/pygplib $ ls * __init__.py atcf: atc...
Python OOP --action() function Question: I'm new to Python OOP and trying to create a OOP program to manage a library. This code is from a book. This code is working as expected but I need to understand how the `action()` calls the corresponding function when I select a particular option, e.g.: when I select `1` the `...
How Can I Make This Python Script Work With Python 3? Question: I downloaded this script to help me convert some PNGs. It is however, from 2003 and the first time I tried to run it, it gave me errors for exception syntax. I managed to fix that and ran it again. Then it gave me errors for the print syntax. I fixed those...
How to overcome "datetime.datetime not JSON serializable" in python? Question: I have a basic dict as follows: sample = {} sample['title'] = "String" sample['somedate'] = somedatetimehere When I try to do `jsonify(sample)` I get: > TypeError: datetime.datetime(2012, 8, 8, 21, 46, 24, 86200...
PSSE/Python import excel values and export bus voltages from PSSE Question: Could someone please help me with Python. I am trying to run 168 newton raphson load flow studies for different values for loads and gens. I have these values set out in an excel spreadsheet and would like to automatically upload these values i...
serializing and deserializing lambdas Question: I would like to serialize on machine A and deserialize on machine B a python lambda. There are a couple of obvious problems with that: * the pickle module does not serialize or deserialize code. It only serializes the names of classes/methods/functions * some of the ...
python csv unicode 'ascii' codec can't encode character u'\xf6' in position 1: ordinal not in range(128) Question: I have copied this script from [python web site][1] This is another question but now problem with encoding: import sqlite3 import csv import codecs import cStringIO import sy...
Uploading command-line utilities to PyPI Question: I made a program that should be run from the shell with only one command (like `$ program_name`, that's it). I'm confused if I should upload this program to the PyPI list because when I browse through the list I have only encountered packages/modules that are designed ...
Why must "exec" (and not "eval") be used for Python import statements? Question: I'm trying to run a snippet of Python from within Java, using Jython. If I use an exec statement to import, everything works. PythonInterpreter pi = new PythonInterpreter(); pi.exec("import re"); PythonObject o = pi....
Write a file in Python 2.7 without getting blocked by Windows? Question: I'm writing a simple fuzzer for use on Windows applications based on the Charlie Miller code from the babysitting an army of monkeys talk. However I keep receiving the error Traceback (most recent call last): File "D:/Python...
Python: How can I group this list of items by category? Question: Working with a Django app. I have a List of `ads` and I want to be able to filter on these in templates (eg, grab all ads of `spot_id = 1`, then pick a random one. I'm using raw SQL via the cursor instead of Django's mysterious querying, so I already ha...
No plotting in matplotlib after version upgrade Question: I just updated matplotlib to 1.1.0 on a server running ubuntu 10.04 LTS in order to play better with pandas. Pandas was converting my index according the functionality of a different version of matplotlib. I installed on one server using "easyinstall -U matplotl...
How to emit an gtk.gdk event with a string as a data package in Python Question: I have a problem in that I need to emit data based on data I receive from a hardware thread. Ideally, I'd like to emit a signal with a data package. I don't know what to fill in for the ???? below. Do I need to make my own event class? ...
Can't rm -r directory using python subprocess.call Question: Welp, I need to remove some huge temporary directories from python and I can't seem to use rm -r. I'm working thought a big dataset (on s3) I don't have the disc space to leave them around. The usual way I would call a command from python is i...
How do I use FCGI with Python (and Django) on Fedora 17? Question: I'm having trouble accessing my "index.fcgi"; I keep getting a 500 Internal Server Error. Here's my error_log: [Thu Aug 09 19:40:17 2012] [warn] [client 127.0.0.1] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI ...
How can I consistently convert strings like "3.71B" and "4M" to numbers in Python? Question: I have some rather mangled code that almost produces the **tangible price/book** from Yahoo Finance for companies (a nice module called `ystockquote` gets the **intangible price/book** value already). My problem is this: For ...
Debian Python 2.5 including module from AlchemyAPI Question: Trying to install **AlchemyAPI.py-2.5** Can't get example running. Debian 6.0 ### python example/sentiment.py: Traceback (most recent call last): File "example/sentiment.py", line 4, in <module> import AlchemyAPI ImportErro...
Reverse DNS lookup in Python Question: If I have an IP address like 2001:4860:4860::8888 How can I get the fully qualified domain in the format foo.ip6.arpa ? EDIT: Both the solutions so far give me google-public-dns-a.google.com - maybe Reverse DNS was the wrong name. For this I'd expect the output to be something l...
Getting the top length of a key in Python Question: > **Possible Duplicate:** > [Find longest (string) key in > dictionary](http://stackoverflow.com/questions/10895567/find-longest-string- > key-in-dictionary) Without folding. Example: from functools import reduce dict = {'t1': 'test1', 'test2': ...
How to get the module from which the currently executing function was called? Question: This is my best solution so far to the problem of accessing the calling module from within a function: import inspect import sys def calling_module(level=0): filename = inspect.stack()[level+2][1] ...
Simple Python Import Question: I have a simple Python import question. I have a module _(let's call it**A**)_ that is importing a module **B**. Module B imports a lot of other modules C, D, E, F, etc. I want module A to be able to use the modules C, D, E, F, etc. Is there an easy way to do this? I don't want to directl...
How to import custom json module instead of the default in python 2.7? Question: Assuming my directory structure is: C:\Scripts\myscript.py C:\Scripts\customjson\json.py The myscript.py python script has at the top: sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'cust...
Newbie. Django Tutorial (from django website) stuck at part 2 - admin Question: I have read many answers here but none did answer my exact question. I did the part one, the polls. I started part 2, the admin, however, after runserve, when i try to acces the page, here is the error i get (my project name is john): ...
Pygame: key.get_pressed() does not coincide with the event queue Question: I'm attempting to work out simple controls for an application using pygame in Python. I have got the basics working, but I'm hitting a weird wall: I am using the arrow keys to control my character. If I hold down one arrow key, then hold down an...