On Wednesday, November 28, 2012 4:38:35 AM UTC-8, dach...@gmail.com wrote:
> Thanks.. Creating two subprocesses worked for me. I did the code as below,
Glad it worked.
--
http://mail.python.org/mailman/listinfo/python-list
On Tuesday, November 27, 2012 8:45:56 PM UTC-8, Roy Smith wrote:
> In the future, the plan is to build a complete fresh virtualenv for
> every deployment. But we're not there yet.
Maybe a repository of virtualenvs, then when deploying you can see if there's
one the matches what you need and use
option is to use a scatter plot with different color per cluster. See the
many examples in http://matplotlib.org/gallery.html.
HTH,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
On Wednesday, December 5, 2012 9:57:31 AM UTC-8, Daniel Doo wrote:
> I am new to Python. Is there a method to “join” two pipe delimited files
> using a unique key that appears in both files?
Have a look at Panda's concat
(http://pandas.pydata.org/pandas-docs/dev/merging.html). It also have util
On Wednesday, December 5, 2012 11:14:42 AM UTC-8, Jason Hsu wrote:
> make the *.csv files publicly available to read.
> Can this be done on Heroku? I've gone through the tutorial, but it seems to
> be geared towards people who want to create a whole web site.
See one option -
http://stackoverfl
> In other words I need a mini, simple browser;
> something I can build that will open, read and
> display a saved html file.
If you want to view the "raw" HTML, use any editor.
If you want to view the rendered HTML (like in a browser), you can point your
favorite browser to a local file or use
import numpy as np
def cos(v1, v2):
return np.dot(v1, v2) / (np.sqrt(np.dot(v1, v1)) * np.sqrt(np.dot(v2,
v2)))
HTH,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
On Saturday, December 8, 2012 12:22:35 PM UTC-8, Jason Hsu wrote:
> 1. How do I run my Python script in Google App Engine and make the output
> results.csv file publicly available?
Probably https://developers.google.com/appengine/docs/python/blobstore/,
however
https://developers.google.com/app
On Thursday, December 13, 2012 7:03:27 AM UTC-8, Daniel Laird wrote:
> I do am import unittest2 as unittest
> NameError: global name 'assertListEqual' is not defined
According to the docs
(http://docs.python.org/2/library/unittest.html#unittest.TestCase.addTypeEqualityFunc)
assertListEqual and f
On Wednesday, December 19, 2012 6:38:30 AM UTC-8, Thomas Bach wrote:
> On Wed, Dec 19, 2012 at 05:47:30AM -0800, hugocoolens wrote:
> > ['0.0364771 0.55569', '0.132688 0.808496', '0.232877 0.832833',
> > '0.332702 0.849128', '0.432695 0.862158']
> xs = [ float(x) for x, _ in map(str.split, l) ]
> y
On Thursday, December 20, 2012 2:11:45 PM UTC-8, Jack Silver wrote:
> I have two Linux From Scratch machine.
> Hence, I do not need to install all those libraries on the client machine.
> Right ?
It depends on what the client needs. For example if you use zlib compression in
the protocol, you'll
On Thursday, December 20, 2012 10:27:54 PM UTC-8, Isml wrote:
> I want to compile python 3.3 with bz2 support on RedHat 5.5 but fail to
> do that. Here is how I do it:
> 1. download bzip2 and compile it(make、make -f Makefile_libbz2_so、make
> install)
Why can't you use yum? (yum install li
On Sunday, January 6, 2013 5:57:17 AM UTC-8, RueTheDay wrote:
> I am getting the following error when running on Python 2.7 on Ubuntu
> 12.04:
> >>
>
> AttributeError: 'Series' object has no attribute 'str'
I would *guess* that you have an older version of pandas on your Linux machine.
Try "p
On Sunday, January 6, 2013 8:03:43 AM UTC-8, marc.assin wrote:
> I wonder how I could specify a parameter on the command line from
> within the interpreter.
Guido wrote some advice a while back -
http://www.artima.com/weblogs/viewpost.jsp?thread=4829
Import your module and call its main.
The oth
On Monday, January 7, 2013 8:20:28 PM UTC-8, iMath wrote:
> How to get the selected text of the webpage in chrome through python ?
You can probably use selenium to do that.
--
http://mail.python.org/mailman/listinfo/python-list
On Thursday, January 24, 2013 2:34:45 AM UTC-8, mik...@gmail.com wrote:
> On Thursday, January 24, 2013 9:43:31 AM UTC, Hazard Seventyfour wrote:
> > for all senior can you suggest me the best, friendly and easy use with nice
> > GUI editor for me, and have many a good features such as auto comple
IMO the code is good enough to submit a patch.
--
http://mail.python.org/mailman/listinfo/python-list
cheeseshop :)
--
http://mail.python.org/mailman/listinfo/python-list
Not that I'm aware of.
I have a script that run the test suite, one of the first commands (before
calling nosetests) is:
find . -name '*.py[co]' -exec rm {} \;
This makes sure the tests run in a "clean" environment.
--
http://mail.python.org/mailman/listinfo/python-list
IMO you can have different versions of Python on the same machine. So it's two
windows machines. (Assuming you're going with *one* OS version :)
Also note there is some legal mambo jumbo around distributing MSVC DLLs (unless
you plan to use mingw).
--
http://mail.python.org/mailman/listinfo/pyt
IIRC it means that cairo was compiled against a Python compiled with
--enable-unicode=ucs4. But the version of Python you have was not (default is
ucs2).
Maybe you can find a different version/packaging of cairo that matches this.
--
http://mail.python.org/mailman/listinfo/python-list
> B[some_hash] still returns an instance of the old class A, while I want
an instance of the new class A.
I don't understand this sentence. How does B[some_hash] related to A?
I've tried the below and it seems to work. Can you paste some code to help us
understand more?
-- old.py --
class A:
> import new_pandas as np
> df = np.DataFrame({'A':[1,2,3],'B':[4,5,6]})
> col_A = df['A']
I'm not familiar with pandas, but my *guess* will be that you'll need to
override __getitem__ in the new DataFrame.
--
http://mail.python.org/mailman/listinfo/python-list
It depends on the overall runtime of the script vs start time of the vm. But
yes in most benchmarks the script start time will bias against scripted
languages.
On a site note: ALL CAPS is considered shouting, please don't use that in news
groups.
--
http://mail.python.org/mailman/listinfo/pyth
Another option is to use a global error flag and set it in sys.excepthook (see
http://docs.python.org/library/sys.html#sys.excepthook).
goodbye will check the error flag and skip execution if error flag is set.
--
http://mail.python.org/mailman/listinfo/python-list
> Having said that, Wine is actually surprisingly capable these days. It
> won't always run the latest release of our all-time favourite WYGIWYD
> character pushing or number layouting programs from MS-Office fame, but at
> least older versions of many a program tend to work rather nicely.
Even new
float('infinity') should be good enough.
--
http://mail.python.org/mailman/listinfo/python-list
help us help you more.
All the best,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
Greetings,
I see several elasticsearch clients on PyPI, any recommendations?
Thanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
Greetings,
I'm going to give a "Python Gotcha's" talk at work.
If you have an interesting/common "Gotcha" (warts/dark corners ...) please
share.
(Note that I want over http://wiki.python.org/moin/PythonWarts already).
Thanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
> Now, if you wish to boggle your mind about something pythonic, how about
> mutexes not being thread safe (http://bugs.python.org/issue1746071)?
This is and old and deprecated module, you should not use it.
Use http://docs.python.org/library/threading.html#threading.Lock and friends
instead.
I
> 8. Opening a URL can result in an unexpected prompt on
> standard input if the URL has authentication. This can
> stall servers.
Can you give an example? I don't think anything in the standard library does
that.
--
http://mail.python.org/mailman/listinfo/python-list
> How may I get a fresh Python shell with Idle 3.2 ?
Open the configuration panel (Options -> Configure IDLE). Look in the "Keys"
tab for the shortcut to "restart-shell"
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
> I'm trying to find a good python library/module that will allow me to
> clip audio files, preferably mp3/ogg format. Does anyone have any good
> suggestions?
I never used it, but I think pymedia might fit the bill.
--
http://mail.python.org/mailman/listinfo/python-list
> Could any expert suggest an authoritative and complete guide for
> developing python modules? Thanks!
I'd start with http://docs.python.org/distutils/index.html
--
http://mail.python.org/mailman/listinfo/python-list
> I would like to execute shell commands, but only if their execution
> time is not longer than n seconds. Like so:
See example at http://docs.python.org/library/signal.html#example
--
http://mail.python.org/mailman/listinfo/python-list
> So I'm interested in suggestions/examples where a user can update a
> config file to specify by which means they want (in this case) the ssh
> functionality to be supplied.
You can do something like that (it's called a factory):
COMMANDS = {
'win32': 'win32 command goes here',
'linux2':
> > I've got a server process written in C++ running on Unix machine.
> > On the same box I'd like to run multiple Python scripts that will
> > communicate with this server.
> >
> > Can you please suggest what would be best was to achieve this ?
As said before, there are many options. Here are som
might find that for a little effort you get enough out of one of these.
Another module which is not in the standard library is hdf5/PyTables and in my
experience very fast.
HTH,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
> I am going to learn python for some plot issues. which book or sources, do
> you recommend please?
The tutorial is pretty good if you already know how to program.
I also heard a lot of good things on "Python Essential Reference".
--
http://mail.python.org/mailman/listinfo/python-list
> How can I make it so, all new python process share this data, so it is only
> loaded a single time into memory?
You can have one process as server and client ask for parts of data.
You might be able to do something smart with mmap but I can't think of a way.
I Linux systems, if you first load t
* Run the following commands in the Terminal window
- sudo apt-get build-dep python
- tar -xjf Python-2.7.3.tar.bz2
- cd Python-2.7.3
- ./configure --prefix=/opt --enable-unicode=ucs2 && make
- sudo make install
* Now you should have /opt/bin/python with ucs2
HTH
--
;vim')
However I get a feeling there's a better way to do that.
Any ideas?
Thanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
> There is a built-in “no value specified” value in Python: the None
> singleton. The ‘argparse’ library uses this for the argument default
> already, so you don't need to fuss with your own special handling
> http://docs.python.org/library/argparse.html#default>.
The problem with this approach is
from some default, or better still,
> automatically calculated so one point is calculated per pixel.
>
> Is there a way to do this in iPython or matplotlib?
I don't think there is, but using range and list comprehension you can write a
little utility function that does that:
HTH
--
> s.name = ["a","b"]
> s.value = [3,5]
>
> I get error that s is not defined. How do I define s and proceed to
> give its attributes?
Either you create a class and use __init__:
class S:
def __init__(self, name, value):
self.name = name
self.value = value
or create a generic
> what is the gui designer that is most popular?
IIRC Qt designer can output Python code.
--
http://mail.python.org/mailman/listinfo/python-list
> Any ideas on how to install a newer version over an older version?
pip uninstall numpy
pip install numpy
--
http://mail.python.org/mailman/listinfo/python-list
path in CentOS is looking at
/usr/local/lib/python2.7/site-packages.
Is there a way to tell bdist_rpm where to install the files to?
Thanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
One thing that comes to mind is importing. py2exe packs libraries in a zip file
so importing might be a bit slower. But this should slow only at the beginning
until everything is loaded to memory.
The other usual suspect is the anti virus :)
--
http://mail.python.org/mailman/listinfo/python-lis
Can you give us more context? Which web framework are you working with?
You can have a look at http://pythonwise.blogspot.com/2007/05/websession.html ;)
--
http://mail.python.org/mailman/listinfo/python-list
http://pypi.python.org/pypi/selenium ?
--
http://mail.python.org/mailman/listinfo/python-list
m"] ...)
If you can switch to 2.7, you'll be to use check_output
(http://docs.python.org/library/subprocess.html#subprocess.check_output)
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
One solution is https://gist.github.com/1027445.
Note that you have a stray , in your last POINT.
I recommend however using some kind of parser framework (PLY?).
--
http://mail.python.org/mailman/listinfo/python-list
I don't have Windows at hand, by I *guess* that the Python DLL is somewhere
near the python executable. You need to make sure the Python DLL is in PATH,
either copy it next to your executable or edit the PATH environment variable.
--
http://mail.python.org/mailman/listinfo/python-list
You might consider trying dateutil.parser.parse
(http://labix.org/python-dateutil#head-c0e81a473b647dfa787dc11e8c69557ec2c3ecd2)
--
http://mail.python.org/mailman/listinfo/python-list
One way is to use pipes, have a look at
http://code.activestate.com/recipes/576709/ for example.
--
http://mail.python.org/mailman/listinfo/python-list
> try:
> import foo
> except ImportError:
> logging.error('could not import foo')
> sys.exit(1)
Why not just let the exception terminate the program? It will have even more
information about the problem that caused foo not to load.
--
http://mail.python.org/mailman/listinfo/python-lis
Have you looked at
http://docs.python.org/library/collections.html#collections.deque ?
--
http://mail.python.org/mailman/listinfo/python-list
how to fix this?
Thanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
If you are spawning the process yourself, you can use subprocess.Popen and then
call p.wait() which is cross platform.
--
http://mail.python.org/mailman/listinfo/python-list
Seems like pyssh (which is very old AFAIK) uses signal. Looks like you're
creating the SSHController instance (which uses pyssh) not in the main thread,
and Python won't allow you to place signal handlers outside the main thread.
You can probably move the SSHContorller creation to the main threa
*Maybe* you can cook something with import hooks (see PEP 302). However I think
the easier option will be to distribute the .py files as well.
--
http://mail.python.org/mailman/listinfo/python-list
You can download the sources tarball and when building specify the compiler.
See http://docs.python.org/install/index.html#gnu-c-cygwin-mingw
--
http://mail.python.org/mailman/listinfo/python-list
Python built in types are enough for this problem IMO. You can use sets of
tuples to specify ticket and drawings and then just do set intersection.
Say the drawing is set([(5, 'wb'), (1, 'wb'), (45, 'wb'), (23, 'wb'), (27,
'wb')]) (keeping black ball out). The you can create a score function:
S
You can probably do that with varargs.
--
http://mail.python.org/mailman/listinfo/python-list
It's the builtin "set", see
http://docs.python.org/library/stdtypes.html#set-types-set-frozenset
--
http://mail.python.org/mailman/listinfo/python-list
http://www.nagios.org/
--
http://mail.python.org/mailman/listinfo/python-list
You might check one of many binary encoders (like Avro, Thrift ...).
The other option is to use a database, sqlite3 is pretty fast (if you schema is
fixed). Otherwise you can look at some NoSQL ones (like MongoDB).
--
http://mail.python.org/mailman/listinfo/python-list
gt; And in addition, maybe return an error so the attacker can be blocked?
You can check if there is a "non-allowed variable" and then return HTTP error.
if set(form) - set(allowedVariables):
print('Status: 406\n\n')
raise SystemExit()
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
I found http://tobi.oetiker.ch/lshort/lshort.pdf very useful.
--
http://mail.python.org/mailman/listinfo/python-list
I guess enumerate is the best way to check for first argument. Note that if
someone passes you the iterator as argument you have now way of checking if the
consumed items from it.
istail can be implemented using itertools.chain, see
https://gist.github.com/1202260
--
http://mail.python.org/mai
using Selenium.
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
Have a look at reduce (http://docs.python.org/library/functions.html#reduce)
--
http://mail.python.org/mailman/listinfo/python-list
> otasks = [
> ...
> print pool.map(f, tasks)
You are running the maps on "tasks" while the list of URLs is called otasks
(unless there's any error in the cut&paste).
HTH,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
an in-memory pickle objects.
HTH,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
You have several option for interfacing with C libraries: Cython, swig,
boost-python, ctypes ...
You can find several machine learning packages mentioned at
http://web.media.mit.edu/~stefie10/technical/pythonml.html, I have no
experience with any of them so I can't recommend any.
HTH
--
> Or, which situations does shelve suit better and which does
> marshal suit better?
shelve ease of use and the fact it uses the disk to store objects makes it a
good choice if you have a lot of object, each with a unique string key (and a
tuple of strings can be converted to and from a string).
object.html?highlight=pyobject#PyObject_GetItem to
get items (from dictionaries and maps).
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
> Is there any way to attach to an already running process by pid? I want to
> send
> commands from python to an application that is already running. I don't want
> to
> give the command name to subprocess.Popen.
We probably need more information. What do you mean by "send commands"? (What
was
> >From looking at the shelve info in the library reference, I get
> the impression it's tricky to change the values in the dict for
> existing keys and be sure they get changed on disk.
You can use writeback=True or call sync at the right places.
> How can you convert a tuple of strings to a str
You can use sets:
teamA = set(random.sample(players, 4))
teamB = set(players) - teamA
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
I used wxPython in several occasion, was very happy with it.
Free, great docs, great community.
--
http://mail.python.org/mailman/listinfo/python-list
(attr)
> sys.exit()
Not that related to the question. But it's usually better to raise an exception.
Exiting in the middle of a function usually make debugging later more
"interesting".
You might find Traits interesting for validation, see
http://code.enthought.com/pro
You can use mechanize, which holds a cookie jar and can user the browser
cookies as well.
--
http://mail.python.org/mailman/listinfo/python-list
hanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
> The easiest solution is to use a plain file system. Make a directory per
> project, and put all distributions of the project into the directory.
> Then have Apache serve the parent directory, with DirectoryIndex turned
> on.
Great, thanks!
--
http://mail.python.org/mailman/listinfo/python-list
> p = subprocess.Popen(shlex.split("kdesu -u test program"))
>
> How can I aquire the PID of the program which kdesu starts?
You can run "ps --ppid " and get the line containing test program.
The first field there should be the child process
27;re on a *nix machine).
See http://pythonwise.blogspot.com/2009/04/pmap.html for example ;)
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
coding the option dictionary.
You can merge the options from the command line though.
options = {"a" : 1, "b" : 2}
opts, args = parser.parse_args()
options.update(opts.__dict__)
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
outside of the current Python process. I
don't think it'll do what you want (different memory segments).
I'd start with either using ctypes/libffi or writing my own C extension wrapper
around your good.
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
I used py2exe and InnoSetup in the past for various Python project, always with
great success. What is the process that you are following?
--
http://mail.python.org/mailman/listinfo/python-list
> In our sandboxed Python environment, I would like to be able to
> trigger an abort of the currently-running Python script (from a signal
> handler or another thread).
There's os.abort
--
http://mail.python.org/mailman/listinfo/python-list
> py2exe would work, but a correct installer would install Python if not
> present, then install the program.
py2exe packs everything you need, including Python. A program created with
py2exe does not depend on installed Python.
--
http://mail.python.org/mailman/listinfo/python-list
> Essentially I want
> certain objects to be a "constantly running process" that may timeout
> after some disuse.
memcached?
--
http://mail.python.org/mailman/listinfo/python-list
Greetings,
I'm reading some data from avro file using the avro library. It takes about a
minute to load 33K objects from the file. This seem very slow to me, specially
with the Java version reading the same file in about 1sec.
Here is the code, am I doing something wrong?
import avro.dataf
I used py2exe in the past for that, see
http://www.py2exe.org/index.cgi/ShippingEmbedded
--
http://mail.python.org/mailman/listinfo/python-list
to write some code in setup.py before calling "setup" to do
the merge.
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
Greetings,
> I am trying to connect SIGINT (^c) to a custom interrupt handler like
> this (no threading, just straightforward):
Why not just catch KeyboardInterrupt?
All the best,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
http://nltk.googlecode.com/svn/trunk/doc/api/nltk.tokenize-module.html ?
--
http://mail.python.org/mailman/listinfo/python-list
201 - 300 of 521 matches
Mail list logo