Re: distributing a binary package

2013-05-06 Thread Miki Tebeka
> Basically, I'd like to know how to create a proper setup.py script http://docs.python.org/2/distutils/setupscript.html -- http://mail.python.org/mailman/listinfo/python-list

Re: distributing a binary package

2013-05-07 Thread Miki Tebeka
> I already have the .so files compiled. http://docs.python.org/2/distutils/setupscript.html#installing-package-data ? -- http://mail.python.org/mailman/listinfo/python-list

Re: python call golang

2013-05-10 Thread Miki Tebeka
> Now! I have written a python script . I want to call a golang script in > python script. > Who can give me some advices? See http://gopy.qur.me/extensions/examples.html and http://www.artima.com/weblogs/viewpost.jsp?thread=333589 -- http://mail.python.org/mailman/listinfo/python-list

Re: Any speech to text conversation python library for Linux and mac box

2013-06-13 Thread Miki Tebeka
On Wednesday, June 12, 2013 8:59:44 PM UTC-7, Ranjith Kumar wrote: > I'm looking for speech to text conversation python library for linux and mac Not a Python library, but maybe you can work with http://cmusphinx.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Imports (in Py3), please help a novice

2013-06-16 Thread Miki Tebeka
> Is there an import / distutils tutorial out there? I'm looking for it, but > perhaps one of you already knows where to find it. Thanks! Did you have a look at http://docs.python.org/3.3/distutils/examples.html? Another thing to do is to look at what other packages on PyPi are doing. -- http

Re: Perl __DATA__ construct.

2012-06-25 Thread Miki Tebeka
> Is there a way to do the same thing in Python? Not without some clever tricks. Either you store data at the beginning of the file or you have another file with the data. If you really need one file and data at the end, you can roll your own. Something like: def data(): with open(__

Re: exe made by py2exe do not run certain computer

2012-07-03 Thread Miki Tebeka
> It works fine on my computer and some other computer don't have python > interpreter(it's Windows 7). > But the same file also do not work on another computer(it's Windows xp) > why does it happen? My *guess* is that you're missing some DLLs (probably some Visual Studio runtime ones). You can

Re: howto do a robust simple cross platform beep

2012-07-14 Thread Miki Tebeka
> How do others handle simple beeps? http://pymedia.org/ ? I *think* the "big" UI frameworks (Qt, wx ...) have some sound support. -- http://mail.python.org/mailman/listinfo/python-list

Re: Diagramming code

2012-07-16 Thread Miki Tebeka
> Is there any software to help understand python code ? For module dependency you can try http://furius.ca/snakefood/ -- http://mail.python.org/mailman/listinfo/python-list

Re: python pynotify with textbox input

2012-08-04 Thread Miki Tebeka
> how can i made a notification for gnome-shell with a textbox input ?? > library: pynotify? You can do it in many ways. You can use one of the Python GUI frameworks - Qt, wx, GTK ... You can use utilities like zenity ... -- http://mail.python.org/mailman/listinfo/python-list

Re: find out whether a module exists (without importing it)

2012-08-06 Thread Miki Tebeka
> imp.find_module(), but > it didn't find any module name containing a '.' The docs (http://docs.python.org/library/imp.html#imp.find_module) clearly say: "This function does not handle hierarchical module names (names containing dots). In order to find P.M, that is, submodule M of package P, use

Re: Todo app help

2012-08-08 Thread Miki Tebeka
> Can someone point me a good tutorial about making a Todo app or similar apps? What do you mean by "app"? For a web app - there are many frameworks out there. Django is the big kid in the block but there are many others (flask, bottle, cherrypy, ...) For GUI application, look at PyQt, wxPython,

Re: How to uncompress a VOB file? (Win XP)

2012-08-13 Thread Miki Tebeka
Have a look at PyMedia. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sharing code between different projects?

2012-08-15 Thread Miki Tebeka
> In plus I'm using perforce which doesn't have any svn:externals-like You can probably use views to this (http://www.perforce.com/perforce/r12.1/manuals/cmdref/o.views.html). > Second problem is that one of the two projects has a quite insane > requirement, which is to be able to re-run itself o

Re: How to convert base 10 to base 2?

2012-08-21 Thread Miki Tebeka
> You get the binary by doing bin(x), where x is an integer. Note that Python also support binary number literals (prefixed with 0b): In [1]: 0b101 Out[1]: 5 -- http://mail.python.org/mailman/listinfo/python-list

Why does dynamic doc string do not work?

2012-08-21 Thread Miki Tebeka
Greetings, >>> class A: ... '''a doc string''' ... >>> A.__doc__ 'a doc string' >>> class B: ... '''a {} string'''.format('doc') ... >>> B.__doc__ >>> Is there's a reason for this? I know I can do: >>> class B: ...__doc__ = '''a {} string'''.format('doc') And it'll work, but I wo

Re: Why does dynamic doc string do not work?

2012-08-21 Thread Miki Tebeka
Thanks! > On 08/21/2012 12:44 PM, Miki Tebeka wrote: > > > > > >>> class B: > > > ... '''a {} string'''.format('doc') > > > ... > > >>>> B.__doc__ > > >>>> &

Re: Dynamically scheduling Cron Jobs for Python Scripts.

2012-09-06 Thread Miki Tebeka
> I want to re run the script at that schedule time to send me a email. Calculate how much time until the meeting. And spawn the script that will sleep that amount of time and then send email. -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Miki Tebeka
I'd look also into dateutil.parser.parse and feedparser._parse_date On Thursday, September 6, 2012 1:34:18 PM UTC-7, John Nagle wrote: > On 9/6/2012 12:51 PM, Paul Rubin wrote: > > > John Nagle writes: > > >> There's an iso8601 module on PyPi, but it's abandoned; it hasn't been > > >> updated

Re: Compile python code into a dll

2012-09-10 Thread Miki Tebeka
> I have Python code that I would like to compile into a dll (I have to See http://docs.python.org/extending/embedding.html. You can pack your code in a zip file and load it from the DLL entry point (something like what py2exe does). See also the Freeze tool - http://wiki.python.org/moin/Freeze

Creating socket.connect while in epoll loop

2012-09-12 Thread Miki Tebeka
Greetings, I'm trying to write a reverse TCP proxy using epoll (just for learning). I've started with the code at http://scotdoyle.com/python-epoll-howto.html and got to https://gist.github.com/3707665. However, I can't create a new connection. When reaching line 34 (backend.connect), I get th

Re: Add a "key" parameter to bisect* functions?

2012-09-12 Thread Miki Tebeka
> I've just noticed that the bisect module lacks of the key parameter. > ... > Is there some reason behind this lack? See full discussion at http://bugs.python.org/issue4356. Guido said it's going in, however there's no time frame for it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Add a "key" parameter to bisect* functions?

2012-09-12 Thread Miki Tebeka
> Correct me if I'm wrong, but the reason for this absence is that people could > think that doing repeated bisects using keys would be fast, even though keys > has to be recomputed? I think the main point Raymond had was: If we added key= to bisect, it would encourage bad design and steer

Re: Creating socket.connect while in epoll loop

2012-09-12 Thread Miki Tebeka
> You cannot synchronously set up a new TCP connection using a non-blocking > > socket. Instead, you begin the connection attempt and it fails with > EINPROGRESS and then you use epoll to find out when the attempt completes. OK. > I suggest reading the implementation of a Twisted reactor to see

Re: Python presentations

2012-09-13 Thread Miki Tebeka
> What do you think work best in general? I find typing during class (other than small REPL examples) time consuming and error prone. What works well for me is to create a slidy HTML presentation with asciidoc, then I can include code snippets that can be also run from the command line. (Somethi

Re: py2exe deal with python command line inside a program

2012-09-28 Thread Miki Tebeka
> sys.executable was printed out as ''C:\\Python25\\python.exe'', how > can I make this work in executable package through py2exe? Does http://www.py2exe.org/index.cgi/WhereAmI help? -- http://mail.python.org/mailman/listinfo/python-list

Re: getting the state of an object

2012-10-07 Thread Miki Tebeka
> Is there a simple way to get the *ordered* list of instance Here's one way to do it (weather doing it is a good idea or not is debatable): from operator import attrgetter def __init__(self, a, b, c, d): self.a, self.b, self.c, self.d = a, b, c, d get = attrgetter('a', 'b

Re: What's the tidy/elegant way to protect this against null/empty parameters?

2012-10-15 Thread Miki Tebeka
> I want to fix an error in some code I have installed, ... Apart from all the reasons why it's bad (see the Python Zen #10). One way to do it is: return [i or '' for i in a] -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Central Python Events Calendar

2012-10-22 Thread Miki Tebeka
> ANNOUNCING > Central Python Events Calendars Thanks, a great idea. -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with ThreadingTCPServer Handler

2012-10-23 Thread Miki Tebeka
According to the docs (http://docs.python.org/library/socketserver.html#requesthandler-objects) there's self.server available. -- http://mail.python.org/mailman/listinfo/python-list

Re: lazy properties?

2012-11-01 Thread Miki Tebeka
> If you're using Python 3.2+, then functools.lru_cache probably > ... And if you're on 2.X, you can grab lru_cache from http://code.activestate.com/recipes/498245-lru-and-lfu-cache-decorators/ -- http://mail.python.org/mailman/listinfo/python-list

Re: fabric question

2012-11-09 Thread Miki Tebeka
> local$ fab remote_info > [remote] Executing task 'remote_info' > [remote] run: uname -a > [remote] out: remote@path$ What happens when you ssh to the machine and run 'uname -a'? (The out: ... is the output) -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Miki Tebeka
> Is there a simpler way to modify all arguments in a function before using the > arguments? You can use a decorator: from functools import wraps def fix_args(fn): @wraps(fn) def wrapper(*args): args = (arg.replace('_', '') for arg in args) return fn(*args) return wr

Re: how to pass "echo t | " input to subprocess.check_output() method

2012-11-26 Thread Miki Tebeka
> But i dont know how to pass the "echo t | " in subprocess.check_output while > calling a process. You need to create two subprocess and connect the stdout of the first to the stdin of the 2'nd. See http://pythonwise.blogspot.com/2008/08/pipe.html for a possible solution. -- http://mail.python

Re: Regular expression for different date formats in Python

2012-11-26 Thread Miki Tebeka
On Monday, November 26, 2012 8:34:22 AM UTC-8, Michael Torrie wrote: > http://pypi.python.org/pypi/python-dateutil > ... > I don't believe the library is updated for Python 3 yet, sadly. dateutil supports 3.x since version 2.0. -- http://mail.python.org/mailman/listinfo/python-list

"non central" package management

2012-11-27 Thread Miki Tebeka
Greetings, The usual package mangers (easy_install, pip ...) install packages in one central location. I'm looking for a solution that will allow every project (which run on the same machine) use it's own packages and versions of packages. (Context - we're running several applications on the s

Re: "non central" package management

2012-11-27 Thread Miki Tebeka
On Tuesday, November 27, 2012 8:21:48 PM UTC-8, Roy Smith wrote: > What we do is run "pip freeze > requirements.txt" and check that into > version control. That's the idea I was toying with, thanks for confirming. > When we deploy, we create a new virtualenv, then do > "pip install -r requirem

Re: how to pass "echo t | " input to subprocess.check_output() method

2012-11-28 Thread Miki Tebeka
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

Re: "non central" package management

2012-11-28 Thread Miki Tebeka
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

Re: Python Cluster

2012-12-04 Thread Miki Tebeka
On Tuesday, December 4, 2012 11:04:15 AM UTC-8, subhaba...@gmail.com wrote: > >>> cl = HierarchicalClustering(data, lambda x,y: abs(x-y)) > but now I want to visualize it if any one suggest how may I use > visualization(like matplotlib or pyplot etc.) to see the data? One option is to use a scatte

Re: Help "joining" two files delimited with pipe character ("|")

2012-12-05 Thread Miki Tebeka
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

Re: Remote server: running a Python script and making *.csv files publicly available

2012-12-05 Thread Miki Tebeka
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

Re: mini browser with python

2012-12-05 Thread Miki Tebeka
> 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

Re: Cosine Similarity

2012-12-06 Thread Miki Tebeka
On Thursday, December 6, 2012 2:15:53 PM UTC-8, subhaba...@gmail.com wrote: > I am looking for some example of implementing Cosine similarity in python. I > searched for hours but could not help much. NLTK seems to have a module but > did not find examples. Should be easy with numpy: import

Re: Running a Python app on a remote server and displaying the output files

2012-12-09 Thread Miki Tebeka
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

Re: Help with unittest2

2012-12-13 Thread Miki Tebeka
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

Re: [newbie] plotting pairs of data

2012-12-19 Thread Miki Tebeka
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

Re: Build and runtime dependencies

2012-12-20 Thread Miki Tebeka
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

Re: compile python 3.3 with bz2 support

2012-12-22 Thread Miki Tebeka
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

Re: Newbie problem with Python pandas

2013-01-06 Thread Miki Tebeka
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

Re: Newbee question about running a script

2013-01-06 Thread Miki Tebeka
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

Re: How to get the selected text of the webpage in chrome through python ?

2013-01-08 Thread Miki Tebeka
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

Re: The best, friendly and easy use Python Editor.

2013-01-25 Thread Miki Tebeka
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

Re: Patching CGIHTTPServer.py

2012-01-28 Thread Miki Tebeka
IMO the code is good enough to submit a patch. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyPI - how do you pronounce it?

2012-01-28 Thread Miki Tebeka
cheeseshop :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Disable use of pyc file with no matching py file

2012-01-30 Thread Miki Tebeka
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

Re: simple system for building packages for multiple platforms?

2012-02-02 Thread Miki Tebeka
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

Re: undefined symbol: PyUnicodeUCS4_AsUTF8String

2012-02-06 Thread Miki Tebeka
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

Re: package extension problem

2012-02-13 Thread Miki Tebeka
> 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:

Re: package extension problem

2012-02-13 Thread Miki Tebeka
> 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

Re: TEST AN EXECUTABLE PYTHON SCRIPT SPEED UNDER A PYTHON SHELL

2012-02-15 Thread Miki Tebeka
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

Re: atexit.register in case of errors

2012-02-15 Thread Miki Tebeka
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

Re: generate Windows exe on Linux

2012-02-22 Thread Miki Tebeka
> 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

Re: PyWart: Language missing maximum constant of numeric types!

2012-02-24 Thread Miki Tebeka
float('infinity') should be good enough. -- http://mail.python.org/mailman/listinfo/python-list

Re: steps to solve bugs

2012-03-10 Thread Miki Tebeka
Greetings, > I am confused over following the steps > explained in the Python website, Are you talking about http://docs.python.org/devguide/? > Kindly some one please tell me in a more > practical and easy way. Can you tell in more details what are the problems you face? This will help us help y

elasticsearch client

2012-03-17 Thread Miki Tebeka
Greetings, I see several elasticsearch clients on PyPI, any recommendations? Thanks, -- Miki -- http://mail.python.org/mailman/listinfo/python-list

Python Gotcha's?

2012-04-04 Thread Miki Tebeka
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

Re: Python Gotcha's?

2012-04-05 Thread Miki Tebeka
> 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

Re: Python Gotcha's?

2012-04-08 Thread Miki Tebeka
> 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

Re: Question on Python 3 shell restarting

2012-04-09 Thread Miki Tebeka
> 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

Re: Python Library or Module for clipping audio files

2012-04-11 Thread Miki Tebeka
> 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

Re: python module development workflow

2012-04-11 Thread Miki Tebeka
> 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

Re: system call that is killed after n seconds if not finished

2012-04-18 Thread Miki Tebeka
> 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

Re: Suggest design to accomodate non-unix platforms ?

2012-04-18 Thread Miki Tebeka
> 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':

Re: Communication between C++ server and Python app

2012-04-30 Thread Miki Tebeka
> > 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

Re: key/value store optimized for disk storage

2012-05-03 Thread Miki Tebeka
> I'm looking for a fairly lightweight key/value store that works for > this type of problem: I'd start with a benchmark and try some of the things that are already in the standard library: - bsddb - sqlite3 (table of key, value, index key) - shelve (though I doubt this one) You might find that f

Re: which book?

2012-05-14 Thread Miki Tebeka
> 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

Re: Sharing Data in Python

2012-05-14 Thread Miki Tebeka
> 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

Re: ucs2 and ucs4 python

2012-05-15 Thread Miki Tebeka
* 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 --

argparse - option with optional value

2012-05-17 Thread Miki Tebeka
Greetings, I'd like to have an --edit option in my program. That if not specified will not open editor. If specified without value will open default editor ($EDITOR) and if specified with value, assume this value is the editor program to run. The way I'm doing it currently is: ... no_ed

Re: argparse - option with optional value

2012-05-18 Thread Miki Tebeka
> 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

Re: Plot a function with matplotlib?

2012-05-19 Thread Miki Tebeka
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 --

Re: getting started

2012-05-25 Thread Miki Tebeka
> 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

Re: what gui designer is everyone using

2012-06-07 Thread Miki Tebeka
> what is the gui designer that is most popular? IIRC Qt designer can output Python code. -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing numpy over an older numpy

2012-06-15 Thread Miki Tebeka
> 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

bdist_rpm from Ubuntu to CentOS

2011-06-02 Thread Miki Tebeka
Greetings, We develop on Ubuntu/Macs and deploy RPMs to CentOS (this is the settings, can't be changed much). The problem is that when installing from the rpm, the packages go to /usr/local/lib/python2.7/dist-packages (which is the right location for Ubuntu). However the default python path in

Re: py2exe: executable is slower than code run from the interpreter

2011-06-04 Thread Miki Tebeka
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

Re: regarding session in python

2011-06-07 Thread Miki Tebeka
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

Re: simple web/html testing

2011-06-07 Thread Miki Tebeka
http://pypi.python.org/pypi/selenium ? -- http://mail.python.org/mailman/listinfo/python-list

Re: parallel computations: subprocess.Popen(...).communicate()[0] does not work with multiprocessing.Pool

2011-06-11 Thread Miki Tebeka
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

Re: How to form a dict out of a string by doing regex ?

2011-06-15 Thread Miki Tebeka
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

Re: Missing python27.dll on Win 7 64-bit

2011-06-17 Thread Miki Tebeka
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

Re: parse date string having "EDT"

2011-06-21 Thread Miki Tebeka
You might consider trying dateutil.parser.parse (http://labix.org/python-dateutil#head-c0e81a473b647dfa787dc11e8c69557ec2c3ecd2) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get return values of a forked process

2011-06-21 Thread Miki Tebeka
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

Re: Handling import errors

2011-06-21 Thread Miki Tebeka
> 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

Re: blist question

2011-07-07 Thread Miki Tebeka
Have you looked at http://docs.python.org/library/collections.html#collections.deque ? -- http://mail.python.org/mailman/listinfo/python-list

json decode issue

2011-07-14 Thread Miki Tebeka
Greetings, I'm trying to decode JSON output of a Java program (jackson) and having some issues. The cause of the problem is the following snippet: { "description": "... lives\uMOVE™ OFFERS ", } Which causes ValueError: Invalid \u escape. Any ideas on how to fix this? Thanks,

Re: Questions about os.waitpid(pid, options) on windows

2011-07-15 Thread Miki Tebeka
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

Re: Signal only works in main thread

2011-07-25 Thread Miki Tebeka
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

Re: Only Bytecode, No .py Files

2011-07-26 Thread Miki Tebeka
*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

  1   2   3   4   >