python-2.6 Questions
14
Solved
I have to write a test case in Python to check whether a jpg image is in color or grayscale. Can anyone please let me know if there is any way to do it with out installing extra libraries like Open...
Mccubbin asked 14/5, 2014 at 17:6
21
I have Python 2.6 in my Linux rhel-5. I have installed pip and required CFFI packages. When I try to run a sample CFFI program:
ffi = FFI()
it says:
File "/usr/lib/python2.6/site-packages/cff...
Hyaluronidase asked 19/12, 2015 at 12:51
39
I downloaded pip and ran python setup.py install and everything worked just fine. The very next step in the tutorial is to run pip install <lib you want> but before it even tries to find anyt...
Hullda asked 20/3, 2012 at 2:43
3
Solved
The format function in builtins seems to be like a subset of the str.format method used specifically for the case of a formatting a single object.
eg.
>>> format(13, 'x')
'd'
is appar...
Stricklin asked 22/5, 2013 at 4:33
10
Solved
I've run into a bit of a wall importing modules in a Python script. I'll do my best to describe the error, why I run into it, and why I'm tying this particular approach to solve my problem (which I...
Vodka asked 11/4, 2013 at 21:53
8
I am trying Create a signed URL with gsutil .
following is the command
$ gsutil signurl -d 10m path/to/privatekey.p12 gs://bucket/foo
mentioned in site https://developers.google.com/storage/doc...
Langrage asked 28/7, 2014 at 11:15
4
Assume you have a list
a = [3,4,1]
I want with this information to point to the dictionary:
b[3][4][1]
Now, what I need is a routine. After I see the value, to read and write a value inside b...
Engenia asked 10/8, 2012 at 15:53
4
Solved
I create two python files, and the directory/file relations is as follows:
mytest---
|---mycommon.py
|---myMainDir---
|----myMain.py
In mycommon.py:
def myFunc(a):
...
And in myMain.py:
...
Jeminah asked 19/8, 2015 at 10:57
13
Solved
How can I get the class that defined a method in Python?
I'd want the following example to print "__main__.FooClass":
class FooClass:
def foo_method(self):
print "foo"
class BarClass(FooClass)...
Selfsatisfaction asked 7/6, 2009 at 2:18
5
I've come across a really weird problem. I'm trying to use Counter function in collections module. However, I keep getting the same error message
AttributeError: 'module' object has no attribute ...
Lailalain asked 9/11, 2012 at 15:38
12
Solved
I'd like to extract only the month and day from a timestamp using the datetime module (not time) and then determine if it falls within a given season (fall, summer, winter, spring) based on the fix...
Centra asked 22/4, 2013 at 4:10
15
Solved
I am writing scripts in Python2.6 with use of pyVmomi and while using one of the connection methods:
service_instance = connect.SmartConnect(host=args.ip,
user=args.user,
pwd=args.password)
I ...
Linguistics asked 16/1, 2015 at 10:7
14
Solved
I'm trying to convert the data from a simple object graph into a dictionary. I don't need type information or methods and I don't need to be able to convert it back to an object again.
I found th...
Sweetscented asked 24/6, 2009 at 4:30
7
Is it possible to execute an arbitrary number of commands in sequence using the same subprocess command?
I need each command to wait for the previous one to complete before executing and I need th...
Bossism asked 27/9, 2016 at 10:10
3
Solved
I am trying to install pip in my python 2.6.6, I have Oracle Linux 6
I followed the answers given at this link Link
I downloaded get-pip.py file and ran the following command
sudo python2.6 get-...
Adim asked 20/12, 2016 at 9:24
13
I am reading How To Learn Python The Hard Way, which uses 2. Recently discovered Invent With Python, which uses 3.
Can I download python 3, and use it when I read Invent With Python, then switch b...
Vimineous asked 2/12, 2010 at 22:55
8
Solved
Background
I am using SQLite to access a database and retrieve the desired information. I'm using ElementTree in Python version 2.6 to create an XML file with that information.
Code
import sqlit...
Ebberta asked 2/3, 2015 at 15:48
5
Solved
I have a zip archive containing a __main__.py file : archive.zip
I can execute it with
python archive.zip
=> OK !
but not with
cat archive.zip | python
=> File "<stdin>", line 1
Sy...
Osmund asked 28/11, 2013 at 23:20
3
Solved
In python 2.6, the following code:
import urlparse
qsdata = "test=test&test2=test2&test2=test3"
qs = urlparse.parse_qs(qsdata)
print qs
Gives the following output:
{'test': ['test'], 't...
Ulcerous asked 21/6, 2009 at 15:23
3
Solved
Currently I trying to get myself acquainted with the matplotlib.pyplot library. After having seeing quite some examples and tutorial, I noticed that the subplots function also has some returns valu...
Surfboat asked 15/4, 2015 at 7:42
6
Solved
I am confused as to why the following code snippet would not exit when called in the thread, but would exit when called in the main thread.
import sys, time
from threading import Thread
def testex...
Nairobi asked 25/5, 2009 at 3:10
3
Solved
I am trying to use python to create the files needed to run some other software in batch.
For part of this I need to produce a text file that loads the needed data files into the software.
My prob...
Wanids asked 12/11, 2013 at 14:41
8
Solved
I've searched and this seems to be a simple question without a simple answer.
I have the file a/b/c.py which would be called with python -m a.b.c. I would like to obtain the value a.b.c in the modu...
Pickings asked 3/3, 2011 at 16:32
2
Edit: Please notice I'm using Python 2.6 (as tagged)
Say I have the following:
class Foo:
def bar(self):
print 'bar'
return 7
And say I have the following unit test:
import unittest
class u...
Glidewell asked 10/6, 2014 at 6:31
2
Solved
I use a MS SQL express db. I can connect and fetch data. But inserting data does not work:
cursor.execute("insert into [mydb].[dbo].[ConvertToolLog] ([Message]) values('test')")
I get no error b...
Thusly asked 25/11, 2013 at 17:36
1 Next >
© 2022 - 2024 — McMap. All rights reserved.