text stringlengths 226 34.5k |
|---|
Getting a 404 on /wd/hub/session when I try to connect to selenium grid remotely via Python
Question: I can see two remotes under the console but when I try to connect remotely and
execute something it fails with a 404.
from selenium import webdriver
browser = webdriver.Remote(
command_executo... |
Importing from custom package fails in Python
Question: So I have a `main.py file` inside `/home/richard/projects/hello-python`
directory:
import sys
sys.path.append('/home/richard/projects/hello-python')
from Encode import Ffmpeg
x = Ffmpeg()
x.encode()
I have the... |
Cannot seem to use import time and import datetime in same script in Python
Question: I'm using Python 2.7 on Windows and I am writing a script that uses both time
and datetime modules. I've done this before, but python seems to be touchy
about having both modules loaded and the methods I've used before don't seem
to b... |
How to add Search_fields in Django
Question: I tried to add search fields in Django using python. Followings are the codes
that I have used.
# admin.py file
from django.db import models
from blog.models import Blog
from django.contrib import admin
admin.site.register(Blog)
c... |
python/excel cell -> png
Question: Folks, There is an excel document that needs weekly updating... Just a few
cells that need to be updated, which is totally doable via:
<http://www.python-excel.org/>
After these cells are updated, a graph is generated inside excel. Is it
possible to export this graph into a .png via ... |
Populate wx.StaticText controls with dictionary key:value pairs
Question: I have a wxPython GUI application that contains 13 pairs of StaticText
controls that I would like to be able to set labels for problematically.
In terms of regression analysis, each pair of StaticText controls represents
an independent variable ... |
How to pass data by 'POST' method to from Javascript to Python
Question: I have this part of script from my GAE application which uses webapp2, which
accepts data from a form using post,
class RenderMarksheet(webapp2.RequestHandler):
def post(self):
regno = self.request.get('content') # ... |
Curve Control With PyQt
Question: Is there any curve control in pyqt?, I have attached a image which is based on
maya gradientControl. I am looking some thing similar with pyqt where I want
to edit the curve and each edit should trigger some signal.Right now I can use
sip and I can wrap maya gradientControl in to my py... |
How to extract value in a xml using lxml in Python
Question:
<XMLReport><Report>
<Preflight errors="0" criticalfailures="0" noncriticalfailures="0" signoffs="0" fixes="0" warnings="10">
<PreflightResult type="Check" level="warning">
<PreflightResultEntry xml:lang="en-US">
<Message>PDF/X... |
how to deploy python webservice on apache
Question: I'm a green hand in Python.I have got a simple webservice with python as
following:
enter code here
import soaplib
from soaplib.core.service import rpc, DefinitionBase
from soaplib.core.model.primitive import String, Integer
from so... |
Python debug print the command
Question: Folks
I am not very up with Python but have inherited a load of Python scripts One
of which is given me a issue in that I am not 100% sure what one line is
running
What I need to do is print out the command line and its variables.
The line in question is
ldapMo... |
drop trailing zeros from decimal
Question: I have a long list of Decimals and that I have to adjust by factors of 10,
100, 1000,..... 1000000 depending on certain conditions. When I multiply them
there is sometimes a useless trailing zero (though not always) that I want to
get rid of. For example...
from... |
plone change in code not visible in development site
Question: I am very new to plone. I have a project folder in eclipse. I have imported it
from the cvs project. I have zope as server and I start zope with
`./bin/instance restart`. When I make changes in my folder, I cannot see the
changes in the development website... |
Logging to two files with different settings
Question: I am already using a basic logging config where all messages across all
modules are stored in a single file. However, I need a more complex solution
now:
* Two files: the first remains the same.
* The second file should have some custom format.
I have been re... |
Facebook publish HTTP Error 400 : bad request
Question: Hey I am trying to publish a score to Facebook through python's urllib2
library.
import urllib2,urllib
url = "https://graph.facebook.com/USER_ID/scores"
data = {}
data['score']=SCORE
data['access_token']='APP_ACCESS_TOKEN'
d... |
os.rename a file to current date in python?
Question: I'm trying to create a zipped archive directory containing files. This will be
done daily so the name of the archive directory must include the date it was
created. I'm unable to rename the directory once it is created due to an
incorrect syntax. Below is the script... |
Where is the syntax error with **finally:* clause?
Question: I'm trying to run Selenium tests for a Django app on production server.
I am getting a syntax error on the **finally:** clause.
I don't see where the error is and all the tests ran fine in development.
Here is the code:
def activate_revisio... |
How do I combine a timezone aware date and time in Python?
Question: I have a date and a time that I'm attempting to combine in Python. The time is
timezone aware.
However, when I try and combine them, I get the wrong time.
import pytz
from datetime import time, date
NYC_TIME = pytz.timezone('Am... |
python-daemon blocks ioctl call to ctypes linked C userlib
Question: I have a Python application in the bottle web-server that accesses a C shared-
object library via the ctypes Python module on a Linux platform. The C so-lib
opens a device node (`/dev/myhwdev`) and asserts an IOCTL function against the
device's file d... |
Python: Urllib2 and OpenCV
Question: I have a program that saves an image in a local directory and then reads the
image from that directory.
But I dont want to save the image. I want to read it directly from the url.
Here's my code:
import cv2.cv as cv
import urllib2
url = "http://cache2.a... |
Python Simple SSL Socket Server
Question: Just trying to set up a simple SSL server. I have never had anything SSL work
for me in the past. I have a loose understanding of how SSL certificates and
signing.
The code is simple
import socket, ssl
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
co... |
how can i use a json output in python
Question: I am trying to figure out how to get a `json` output in `python`. here is the
url:
[http://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Victoria+BC&mode=bicycling&language=fr-
FR&sensor=false](http://maps.google... |
Where I could find good explanation how Google App Engine python27 threads works and what are limitations?
Question: Where is good information about **threads implementation in python27 on Google
App Engine** especially but not only:
1. What is threading limitation (how many thread could be spawn, what is number of ... |
package that works inside and outside django. Is this a good design?
Question: I'm relative new to django and in generall to the python world. But I have
experience with ruby (been working with rails for 2 years) so many concepts of
python/django are not that new to me.
Anyway, I am writing an small package in python ... |
Python tuple operations and count
Question: I have the following tuple.I want to build a string which outputs as stated in
output.I want count all the elements corresponding to 'a' i.e, how many k1
occured w.r.t 'a' and so on .What is the easiest way to do this
a=[('a','k1'),('b','k2'),('a','k2'),('a','k... |
Google App Engine + PyCrypto = /dev/urandom not accessible
Question: I am using Google App Engine and PyCrypto to do some encryption. The error I
am getting, which is below, occurs _only on my local developement server,_
which is running Linux Mint Maya (13). I deployed the same code to the GAE
cloud, and it runs witho... |
get max duplicate item indexes in a list using python
Question: As someone here pointed me out, for getting the max duplicated item in a list
this can be used:
>>> from collections import Counter
>>> mylist = [20, 20, 25, 25, 30, 30]
>>> max(k for k,v in Counter(mylist).items() if v>1)
30
... |
Encrypt using Python and decrypt in jQuery/Javascript?
Question: I have some JSON data that I need to encrypt before sending it to the client
side. I can encrypt the data using pycrpto like this:
from Crypto.Cipher import AES
key = '0123456789abcdef'
mode = AES.MODE_CBC
encryptor = AES.new(ke... |
Integrate protocol buffers into WAF
Question: I managed to compile my `.proto` files like this:
def build(bld):
bld(rule='protoc --cpp_out=. -I.. ${SRC}', source='a.proto b.proto', name='genproto')
Seems to work nice, when I make changes to the source files, they are
recompiled and so on. B... |
How to find full module path of a class to import in other file
Question: I have method that returns module path of given class name
def findModulePath(path, className):
attributes = []
for root, dirs, files in os.walk(path):
for source in (s for s in files if s.endswith(".py"... |
memory error in python
Question:
Traceback (most recent call last):
File "/run-1341144766-1067082874/solution.py", line 27, in
main()
File "/run-1341144766-1067082874/solution.py", line 11, in main
if len(s[i:j+1]) > 0:
MemoryError
Error in sys.excepthook:
Traceback (most recent call l... |
Does my test automation strategy sound ludicrous?
Question: I am developing an automation testing framework for testing a web service. The
web service is SOAP and implemented in Java (via Apache Axis2), however, our
tests are implemented in Python and uses the suds library to issue requests to
the server. The tests are... |
New URL on django admin independent of the apps
Question: I am using django 1.4 and Python 2.7.
I just have a simple requirement where I have to add a new URL to the django
admin app. I know how to add URLs which are for the custom apps but am unable
figure out how to add URLs which are of the admin app. Please guide ... |
How to use boost::python::iterator with return_internal_reference?
Question: I have a class `Type` which cannot be copied nor it contains default
constructor. I have second class `A` that acts as a set of the above classes.
This second class gives access via iterators and my iterator has dereference
operator:
... |
Can import objc module in python 2.6 but NOT in python 2.7
Question: My system: Mac OS X 10.6.8, gcc 4.2, python 2.7, xcode 3.2.3
I use python 2.7 and I got error when tried to do: `import objc`, it returns:
`ImportError: No module named objc`.
It looks like the objc module is not there. But actually I have the objc
... |
python pexpect sendcontrol key characters
Question: I am working with pythons pexpect module to automate tasks, I need help in
figuring out key characters to use with sendcontrol. how could one send the
controlkey ENTER ? and for future reference how can we find the key
characters?
here is the code i am working on.
... |
Python Redhat version issue
Question: > **Possible Duplicate:**
> [Upgrade python without breaking
> yum](http://stackoverflow.com/questions/10624511/upgrade-python-without-
> breaking-yum)
I'm running a Redhat VM (2.6.18-274.el5 64 bit). I installed nodejs on the vm
in order to use browserstack. To get nodejs runn... |
Python tkinter : loop in Label
Question: Hello I just wanted that the Label change/refresh during the loop, but it
doesn't work
This my code
fen1 = Tk()
v = StringVar()
Label(fen1,textvariable=v).pack()
i=0
while(1):
i=i+1
v.set(i)
fen1.mainloop()
... |
What is the cross-platform method of enumerating serial ports in Python (including virtual ports)?
Question: **Note:** I'm using Python 2.7, and pySerial for serial communications.
I found this article which lists two ways:
<http://www.zaber.com/wiki/Software/Python#Displaying_a_list_of_available_serial_ports>
This m... |
Inheritance in web.py?
Question: I am currently developing wep.py application. This is my web application which
is binded with web.py and wsgi.
root/main.py
import web
import sys
import imp
import os
sys.path.append(os.path.dirname(__file__))
#from module import module
... |
Pickle incompatability of numpy arrays between Python 2 and 3
Question: I am trying to load the MNIST dataset linked
[here](http://deeplearning.net/tutorial/gettingstarted.html) in Python 3.2
using this program:
import pickle
import gzip
import numpy
with gzip.open('mnist.pkl.gz', '... |
How to debug/log wsgi python app?
Question: I tried this:
#!/usr/bin/python
from wsgiref.simple_server import make_server
from cgi import parse_qs, escape
import logging
import os
import sys
html = """
<html>
<body>
<form method="post" action="parsing_... |
how to design a page in django cms
Question: I want to design a page in django that has a search bar in which user enters a
keyword to search it in the 10 xml documents . I have designed the python code
for searching the words using xml parsing. I also have developed an app called
"**search** " in django but that app h... |
Weekly Cron Job on a Specific Day
Question: I created the following cron job yesterday to run every Tuesday at 12:01 AM (I
think), but it did not run last night. Running the command as I have it in the
cron file works. What did I get wrong here?
1 0 * * 2 python2.7 /path/to/django/manage.py my_command > ... |
Python - Mutliprocess, member functions of classes
Question: I can't figure out if this is because of me, or the multiprocessing module
that Python2.7 has. Can anyone figure out why this is not working?
from multiprocessing import pool as mp
class encapsulation:
def __init__(self):
... |
Parsing a pwdump file python
Question: I'm trying to parse a pwdump file in python. The content of a pwdump file
looks like this:
...[snip]
Domain\TESTIN$::aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest(current):501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d1... |
Biopython class instance - output from Entrez.read: I don't know how to manipulate the output
Question: I am trying to download some xml from Pubmed - no problems there, Biopython is
great. The problem is that I do not really know how to manipulate the output.
I want to put most of the parsed xml into a sql database, b... |
Python: How to send POST request?
Question: I found this script online:
import httplib, urllib
params = urllib.urlencode({'number': 12524, 'type': 'issue', 'action': 'show'})
headers = {"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"}
conn = httplib... |
Python XML parsing comparison of files
Question: I have to compare two XML files using Python. Each has a list of items and I
have to output which items do not appear in both. Each item has various
properties which need to agree to see if it's the same item.
Which parser would be the most suitable. It has to already b... |
Unindent does not match any outer indentation level?
Question: > **Possible Duplicate:**
> [IndentationError: unindent does not match any outer indentation
> level](http://stackoverflow.com/questions/492387/indentationerror-unindent-
> does-not-match-any-outer-indentation-level)
I have the following python code.
... |
Store information into .exe file, exported from python
Question: I have to generate an executable (.exe) file from my python program. I would
like to store information in a persistent way within this .exe file itself.
Normally I would prickel it into an external file, however for me it is
important that the informatio... |
FANN Error 11: Unable to allocate memory
Question: In the Python implementation of FANN, I got this error from
from pyfann import libfann
ann = libfann.neural_net()
ann.create_standard(4, 2, 8, 9, 1)
#FANN Error 11: Unable to allocate memory.
Any suggestion?
Answer: There is a bug in ... |
How can you compute percentiles and ranks with a generator on a single pass?
Question: Building off and earlier question: [Computing stats on generators in single
pass. Python](http://stackoverflow.com/questions/11308146/computing-stats-on-
generators-in-single-pass-python)
As I mentioned before computing statistics f... |
Return reoccuring regex matches with python
Question: I have a string:
SomeTextSomeTextA _SomeThing_ BSomeTextSomeTextA _SomeThingElse_ BSomeText
I want to have the Strings SomeThing and SomeThingElse string returned because
they are bracketed with A and B and assuming SomeText does not contain any A
..... |
Importing another module from another subdirectory of the current directory's parent directory (python)
Question: I'm attempting to write a game. I therefore have lots of different types of
code and want to arrange them in a useful hierarchy.
I've looked at solutions that involve placing `__init__.py` in each folder b... |
appcfg.py is not running with cmd prompt (Windows 7)
Question: I am having strange problem. I used to run appcfg.py to update my app to
appengine but now its not working anymore. When I run this command
C:\Program Files <x86>\Google\google_appengine>appcfg.py update E:\path\myApp\
Its not giving me... |
How to get integer values from a string in Python?
Question: Suppose I had a string
string1 = "498results should get"
Now I need to get only integer values from the string like `498`. Here I don't
want to use `list slicing` because the integer values may increase like these
examples:
... |
What are advantages and disadvantages of abstracting our database behind stored procedures?
Question: At work we currently have a PostgreSQL database and we access it via some Perl
bindings to access the database and marshal responses to Perl types. This
works OK, but for various reasons we are becoming unhappy with Pe... |
accessing files in a folder using python
Question: I have a python script that runs a program, which generates few .exe files and
puts them in a folder. I want to access these exe files to do further testing,
the problem is that this folder name is not static (it's dynamic? ), the name
depends on the OS,compiler,binary... |
Biopython -- reading a fixed number of seq_records at a time
Question: I built some code that retrieves PHRED scores from a fastq file, puts them all
into a single list, and then passes the list on to another function. It looks
like so:
def PHRED_get():
temp_scores = []
all_scores = []
... |
Python/SciPy version of Excel FInv function
Question: Hopefully an easy one. Can anyone point me to the SciPy function that will
calculate a right-tailed F Probability Distribution?
Like Excel's `=FINV(0.2, 1, 2)` that results in `3.555555556`. Thanks, Scott
Answer:
import scipy.stats
print scipy.stats... |
Debugging Python ctypes segmentation fault
Question: I am trying to port some Python ctypes code from a Windows-specific program to
link with a Linux port of my library. The shortest Python code sample that
describes my problem is shown below. When I try to execute it, I receive a
segmentation fault in examine_argument... |
Changing a file line - Python
Question: I've a file entitled **'users.txt'** with the following structure;
`username:info_about_the_user.`
Something like this:
**users.txt:**
> mark:stuffabouthim
> anthony:stuffabouthim
> peter:stuffabouthim
> peterpeter:stuffabouthim
> peterpeterpeter:stuffabouthim
> ... |
Convert byte string to string in python
Question: I'm using PyCrypto, and python 2.7.3. I'm attempting to prepend a regular
string to the hash to create a chained hash, but to keep formats consistent, I
need the string s in the 'printed' form instead of the binary form. Is there
any way to convert the binary string int... |
How to dispatch requests for one URL to multiple threads?
Question: This is a test application:
#!/usr/bin/env python
from flask import Flask
from time import sleep
application = Flask(__name__)
application.debug = True
@application.route('/a')
@application.route('/... |
Python/POpen/gpg: Supply passphrase and encryption text both through stdin or file descriptor
Question: I'm trying to remote control gpg through a python program via `POpen`.
I have a file that contains encrypted data which I want to decrypt, modify and
write back to disk re-encrypted.
Currently I am storing the de... |
CX_Freeze import error on Windows and ZMQ
Question: I've a python program that uses ZMQ. I want to Freeze it so everyone can use
it as executable. This is my setup.py
import sys
from cx_Freeze import setup, Executable
includes = ["sip", "re", "zmq", "PyQt4.QtCore", "atexit", "zmq.utils.strty... |
Signing data in Android and Verifying it in python
Question: I have written the following code to Sign data in android:
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
... |
Node.js Saving a GET request's HTML response
Question: I'm apparently a little newer to Javascript than I'd care to admit. I'm trying
to pull a webpage using Node.js and save the contents as a variable, so I can
parse it however I feel like.
In Python, I would do this:
from bs4 import BeautifulSoup # fo... |
Python 2 and Python 3 dual development
Question: I'm just starting a new Python project, and ideally I'd like to offer Python 2
and 3 support from the start, with minimal developmental overhead. My question
is, what is the best way of doing this for brand new projects?
I have come across projects that run 2to3, or eve... |
How to display leading zeros after splitting numbers in Python
Question: Is there any way I can display leading zeros after splitting numbers into
parts like first 3 digit and last 2 digit in Python 3.2? My script returns the
numbers with no leading zeros...
I have a csv file that looks like this:
Name,... |
Plot numpy datetime64 with matplotlib
Question: I have two numpy arrays 1D, one is time of measurement in datetime64 format,
for example:
array([2011-11-15 01:08:11, 2011-11-16 02:08:04, ..., 2012-07-07 11:08:00], dtype=datetime64[us])
and other array of same length and dimension with integer dat... |
Cannot access member variable using abc module and properties in python
Question: I wrote a code that simulates the use of `abc` module and `properties`.
However, it seems that I couldn't be able to access `width` and `height`
variables. The code is as the following:
from abc import ABCMeta, abstractmeth... |
Python (w/ pyglet) memory leak
Question: In a very large project I'm searching for a memory leak. Here my progress so
far:
Using a class counter,
import gc
from collections import Counter
def count():
return Counter(type(o).__name__ for o in gc.get_objects())
I see that for each ... |
RESTFUL POST with Python request to Glassfish Server
Question: I'm having a difficulty trying to make a Python REST POST to a webservice
running on Glassfish. I have verified that POST works ok using CURL but having
no luck with Python.
**Here is the CURL request that works ok.**
curl -X POST -H "Conten... |
csv reader behavior with None and empty string
Question: I'd like to distinguishing `None` and empty strings when going back and forth
between Python data structure and csv representation using Python's `csv`
module.
My issue is that when I run:
import csv, cStringIO
data = [['NULL/None value',... |
Publishing on Facebook fan page with Python
Question: I tried a couple of codes about how to publish on Facebook wall. But I would
like do a little bit different. I wonder publish in my facebook fan page. The
following code just publish on my personal profile. Can any one give me a clue
to publish in fan page?
... |
urlopen always retrieves the same webpage
Question: I am trying to parse webpages using urllib2, BeautifulSoup and Python 2.7.
The problem lies upstream: each time I try to retrieve a new webpage, I get
the one I already retrieved. However, pages are different in my webbrowser:
see [page 1](http://www.senscritique.com... |
Passing arguments to tp_new and tp_init from subtypes in Python C API
Question: I originally asked this question on the Python capi-sig list: [How to pass
arguments to tp_new and tp_init from
subtypes?](http://mail.python.org/pipermail/capi-sig/2012-July/000500.html)
I'm reading the Python [PEP-253](http://www.python.... |
Python osascript returning 0 it seems
Question: I'm trying to work with applescript for retrieving BPM values of songs.
Eventually I'd like to implement it with a game. Here's my code:
import os
import time
import sys
def getBPM():
iTunesInstruct = """'
tell applicat... |
Incorrect datetime value: ''2012-07-14 23:00:00''
Question: I'm having some trouble with the datetime format with Python/MySQL.
I calculate the datetime using the following script (fed by a Python
dictionary):
tempDate = str(eachday.get("date").get("year")).zfill(4) + "-" +
str(eachday.get("date")... |
double to PyFloat conversion is incorrect
Question: I'm learning SWIG, for using C in Python. I've written this function, but I
can't understand, why the wrapped `myfunc` returns wrong float/double values:
mfuncs.c
#include <stdlib.h>
float myfunc(int n) {
float result;
result =... |
In Python, how can I turn this format into a unix timestamp?
Question:
Mon Jul 09 09:20:28 +0000 2012
If I have a format like that as a STRING, how can I turn it into a unix
timestamp?
Note: I'm getting this format from Twitter's API:
[https://api.twitter.com/1/statuses/user_timeline.json?include_entities=... |
Cloudera CDH3 installation failure, how to get around this?
Question: I am attempting to install CHD3 onto a 3 node cluster. I launch the
installations via the Cloudera Manager. All three installations fail.
I see this error after the Cloudera installation fails in /var/log/cloudera-
scm-agent/cloudera-scm-agent.out:
... |
Starting and stopping processes in a cluster
Question: I'm writing software that runs a bunch of different programs (via
[twisted's](http://twistedmatrix.com) `twistd`); that is N daemons of various
kinds must be started across multiple machines. If I did this manually, I
would be running commands like `twistd foo_work... |
symbol picked up from wrong dylib on linking
Question: I am linking a binary which imports a symbol defined in two dependent dylibs,
and I can't make `ld` to pick the correct one.
The symbol is `_init_process` and it's defined both in libSystem.dylib (added
by ld implicitly) and libida.dylib (our library). I want `ld`... |
How to Write python code in a wordpress blog?
Question: I want to write some python code in a wordpress blog but whitespaces are not
preserved. Can some one please tell me how to write my python code in the blog
with the proper indentation and styling preserved as indentation is very
important for python code.
Answer... |
How to update imshow in matplotlib without overwriting new color bar or subplot title?
Question: **Background:** I am working an a data processing application and am trying to
visualize 2D arrays with matplotlib embedded into a tkinter gui. I am trying
to update the matplotlib figure by collecting user input (i.e. what... |
Django: Query returns different results in management command
Question: I have a django application with a model named `TestCase`. There are 9
instances of the model currently stored in the DB, which I can see by running
`TestCase.objects.all()` in the shell, and they're also being displayed
correctly in my views.
How... |
Remove certain return characters from tab-separated values file
Question: I've got a problem at work that requires me to insheet some MASSIVE tab-
separated values files (think 8-15 GB .txt files) into my PostgreSQL DB, but
I've run into a problem with the way the data was formatted in the first
place. Basically, the w... |
directory path types with argparse
Question: My python script needs to read files from a directory passed on the command
line. I have defined a readable_dir type as below to be used with argparse for
validating that the directory passed on the command line is existent and
readable. Additionally, a default value (/tmp/n... |
Web servers vs application servers, Open source database Security vs Enterprise Database security
Question: I am working on creating a spec for a startup to create a financial broker
check website. It involves storing information about financial advisers and
payment details of the users (so obviously needs a lot of sec... |
Print two presorted lists into one output file in python
Question: I have two lists that are already sorted how they need to be, and i need them
put into one file, like this example:
list1 = [a, b, c, d, e]
list2 = [1, 2, 3, 4, 5]
output file should look like:
a1
b2
c3
... |
Importing Maya module into Nuke (Python)
Question: I can import the maya module with ease through the Python 2.7 IDE, but when
working with Nuke's script editor, I cannot import Maya and get a "No module
named maya" error
Any help?
Answer: well if you want to import maya modules you can add the path of "E:\Program
F... |
How to Read a Simple Json Result (from Google calculator) in Python?
Question: I'm trying to parse a json result from the next google Query:
[http://www.google.com/ig/calculator?hl=en&q=1USD=?MXN](http://www.google.com/ig/calculator?hl=en&q=1USD=?MXN)
The result is this:
{lhs: "1 U.S. dollar",rhs: "13.... |
Compare values of two arrays in python
Question: How can i check if item in `b` is in `a` and the found match item in `a`
should not be use in the next matching?
Currently this code will match both 2 in `b`.
a = [3,2,5,4]
b = [2,4,2]
for i in b:
if i in a:
print "%d is in a" %... |
python sterling's approximation program
Question: I'm trying to write a simple program that prints the first [Stirling's
approximation](http://en.wikipedia.org/wiki/Stirling%27s_approximation) for
the integers 1:10 alongside the actual value of 1:10 factorial. This is my
code:
import math
nf =1 ... |
How can I save a LibSVM python object instance?
Question: I wanted to use this classifier in other computer without had to train it
again. I used to save some classifiers from scikit with cPickle. Doing the
same with LIBSVM it gives me a " ValueError: ctypes objects containing
pointers cannot be pickled ".
I'm using L... |
POST Message for uploading large file To Google Drive without Google Driver UI
Question: My understanding is that to upload a large file to Google Drive from my own
app using version 2 of the API, I should be sending a message like below.
Unfortunately, I do not know how to achieve this format for the multipart
message... |
Regex passes in Rubular but not in Python
Question:
import re
import urllib.request
file_txt = urllib.request.urlopen("ftp://ftp.sec.gov/edgar/data/1408597/0000930413-12-003922.txt")
pattern_item4= re.compile("(Item\\n*\s*4.*)Item\\n*\s*5")
print(re.search(pattern_item4,bytes.decode(f)))
#Retur... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.