IIRC creating a directory is atomic in most environments.
On Sunday, February 9, 2014 2:39:51 AM UTC-8, Asaf Las wrote:
> Hi
>
>
>
> Which one is most recommended to use for mutex alike locking to
>
> achieve atomic access to single resource:
>
>
>
> - fcntl.lockf
>
> - os.open() with O_
g = root.find('config[@id="B"]')
for panel in cfg.findall('panel'):
panels.append([{elem.tag: elem.text} for elem in panel])
You'll need to do some parsing for the coordinates and handle canvas and
comments separately.
HTH,
Miki
--
https://mail.python.org/mailman/listinfo/python-list
> When I enter into the command window "pip install matplotlib", it reads this
> below (this is not the full version of it):
> ...
Installing scientific packages can be a pain. I recommend you take a look at
https://www.continuum.io/downloads
--
https://mail.python.org/mailman/listinfo/python-l
/2016/ to see more details.
See you there,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
le?
We need more information. What is the test suite you're using? How are you
running the tests? Example output ...
All the best,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
Greetings,
I've compiled a list of "python -m" tools at
pythonwise.blogspot.com/2015/01/python-m.html.
Did I miss something? What are your favorite "python -m" tools?
Thanks,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
Thanks for all the answers!
--
https://mail.python.org/mailman/listinfo/python-list
> I want to develop a instant message server, simply has user and group
> entity.
> Is there any better existing open-source one?
> Thus I can download and have a look.
You can take a look at Twisted Words
(https://twistedmatrix.com/trac/wiki/TwistedWords).
--
https://mail.python.org/mailman/l
Greetings,
http://pypi2u.appspot.com/ is a simple service that notifies you on new
versions of packages you're interested in.
You can view the code, fill bugs and suggest ideas at
https://bitbucket.org/tebeka/pypi2u
Hope you find it useful,
--
Miki
--
https://mail.python.org/mailman/lis
control
3. Credentials service (such as ZooKeeper) accessed only from VPN
4. Credentials pre user encrypted (gpg) and stored in source control
What method are you using? Are there any best practices in the subject?
Thanks,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
>> How do you deal with tests (both on dev machine and Jenkins) that need
>> credentials (such as AWS keys)?.
> I've done several of these. Another option that may work in some
> contexts is to mock the test altogether;
Thanks, but mocking is last resort for me, it reduces the value of testing
gr
> I have seen by chance a number of years ago a book on Python programming
> for running on mobile phones (of a certain producer only). What is the
> current state of the art in that? Could someone kindly give a few good
> literature references? Thanks in advance.
I'm not an expert, but take a look
> (If you don't know what the strop
> module is, go ahead and forget it now.)
+1 QOTW :)
--
https://mail.python.org/mailman/listinfo/python-list
Who is killing the daemon threads?
> ...
> It it possible that this will cause the program to hang in any case?
If due to a bug in the cleanup thread it hangs - the program will hang as well.
All the best,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
> Is it possible with argparse to have this syntax for a script?
> my-script (-a -b VALUE-B | -c -d VALUE-D)
>
> I would like to do this with the argparse module.
You can probably do something similar using sub commands
(http://docs.python.org/2/library/argparse.html#sub-commands).
--
http://mai
> Wouldn't it
> better to add a feature to Python to write the name of DLL which load
> has been failed?
If you start Python with the -v (verbose) flag, you can see all the calls to
dlopen.
--
http://mail.python.org/mailman/listinfo/python-list
On Tuesday, October 29, 2013 10:48:58 AM UTC-7, Barry Warsaw wrote:
> So too has my latest stint as Python Release Manager. Over the 19 years I
> have been involved with Python,
Thanks Barry for all the hard work.
--
https://mail.python.org/mailman/listinfo/python-list
python.org takes 0.209 total) and
the size (Content-Length).
Anything gone wrong or am I missing something?
Thanks,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
Thanks Chris, I was hitting the wrong URL by mistake.
Didn't think an extra / will make all that difference :)
On Tuesday, March 10, 2015 at 2:12:13 PM UTC+2, Chris Angelico wrote:
> On Tue, Mar 10, 2015 at 10:55 PM, Steven D'Aprano
> wrote:
> > Miki Tebeka wro
> If anyone may kindly suggest what is the error I am doing.
It's close to impossible to know without seeing the server side code.
--
https://mail.python.org/mailman/listinfo/python-list
is linked
from "PyPI Support") seems pretty deserted. What is the right location for
these kind of issues?
Thanks,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
> >The forums at https://sourceforge.net/p/pypi/support-requests/ (which is
> >linked from "PyPI Support") seems pretty deserted. What is the right
> >location for these kind of issues?
> That is one place.
> https://bitbucket.org/pypa/pypi/issues
Thanks!
--
https://mail.python.org/mailman/lis
> What are your best time saving tips when programming Python?
* Use the REPL. Write small chunks of code and test them as you go
* Know what's available in the standard library (sets, Counter, deque ...)
* Learn how to pick good packages from PyPI (community, last commit ...)
* import this
--
htt
Greetings,
> 0. Classes where Idle is used:
> Where?
At client site. Mostly big companies.
> Level?
>From beginner to advanced.
> Idle users:
> 1. Are you
> grade school (1=12)?
> undergraduate (Freshman-Senior)?
> post-graduate (from whatever)?
post-graduate
> 2. Are you
> beginner (1st class,
On Thursday, September 10, 2015 at 1:11:59 PM UTC+3, chen...@inhand.com.cn
wrote:
> hi:
> I have to use numpy package. My python runs on my embedded arm
> device. So, how do i cross compile numpy?
conda has support for ARM - http://continuum.io/blog/new-arch
BTW: I suggest you write a better
> I been trying to compile matplotlib in a python3.4 virtual env using
> pip version 1.7 on Fedora 22. I am in about 3 weeks learning python
> and Django so I am not clear on the error response to:
> ...
> File "/usr/lib64/python3.4/distutils/version.py", line 343, in _cmp
> if self
lake8.
flake8 supports ignoring certain lines by appending a comment starting with #
NOQA
HTH,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
> Is there a library for Python that can easily create flowcharts using a
> simple API?
Maybe https://code.google.com/p/pydot/ ?
--
https://mail.python.org/mailman/listinfo/python-list
he developer libraries for that (including the C header
files). IIRC "sudo apt-get build-dep python" should install all the required
packages.
HTH,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
Greetings,
> >>> import pandas as pd
>
> No module named numpy
I find the most painless way of installing the Python scientific stack is using
Anaconda
http://continuum.io/downloads
HTH,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
sts' is not defined
You need to call mydown.requests, but I think you're missing the point of
modules and imports. I suggest you go over https://docs.python.org/3.4/tutorial/
HTH,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
ow + ([None] * (max_length - len(line))
max_length = 10
with open('data.csv') as fo:
df = pd.DataFrame.from_records(gen_rows(fo, max_length))
HTH,
Miki
--
https://mail.python.org/mailman/listinfo/python-list
Greetings,
Before I start writing my own. Is there something like collections.Counter
(fore frequencies) that does "fuzzy" matching?
Meaning x is considered equal to y if abs(x - y) < epsilon. (x, y and my case
will be numpy.array).
Thanks,
--
Miki
--
https://mail.python.org/mai
On Tuesday, September 23, 2014 4:37:10 PM UTC+3, Peter Otten wrote:
> x eq y
> y eq z
> not (x eq z)
>
> where eq is the test given above -- should x, y, and z land in the same bin?
Yeah, I know the counting depends on the order of items. But I'm OK with that.
--
https://mail.python.org/mailman/
On Tuesday, September 23, 2014 7:33:06 PM UTC+3, Rob Gaddi wrote:
> While you're at it, think
> long and hard about that definition of fuzziness. If you can make it
> closer to the concept of histogram "bins" you'll get much better
> performance.
The problem for me here is that I can't determin
Greetings,
On Wednesday, September 24, 2014 5:57:15 PM UTC+3, Ian wrote:
> Then your result depends on the order of your input, which is usually
> not a good thing.
As stated in previous reply - I'm OK with that.
> Why would you need to determine the *number* of bins in advance? You
> just need t
io.data import DataReader
>
> ImportError: No module named pandas.io.data
* Do you have pandas installed? (Does "import pandas" work?)
* If it is installed, what version do you have? ( "print(pandas.__version__")
HTH,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
free for small-ish sites and removes a lot of operations headache.
All the best,
--
Miki
--
https://mail.python.org/mailman/listinfo/python-list
1. Can you post the code somewhere where it's indented properly?
(http://paste.pocoo.org/)
2. In the list example you call balls_in_numbered_boxes(2, [3,3,3]) but in the
interactive example you call balls_in_numbered_boxes(3,[3,3,3])
--
http://mail.python.org/mailman/listinfo/python-list
You can add "# coding=UTF8" to the top of your file (see
http://www.python.org/dev/peps/pep-0263/).
Of you want to remove unicode, there are several options, one of them is
passing the file through "iconv --to ascii".
--
http://mail.python.org/mailman/listinfo/python-list
I personally like CherryPy. But it all depends on your needs and style. I
suggest you play with some of the packages and select one that you feel best
with.
--
http://mail.python.org/mailman/listinfo/python-list
.separator (and .import) are not SQL commands but "sqlite3" commands.
You can get the same effect with the following code:
with open('/tmp/data.csv') as fo:
reader = csv.reader(fo)
cur.executemany('INSERT INTO quote VALUES (?, ?, ?, ?, ?, ?, ?)')
I'd go for a factory function
(http://en.wikipedia.org/wiki/Factory_method_pattern):
def create(foo):
return Child(foo) if foo else Parent()
--
http://mail.python.org/mailman/listinfo/python-list
As a side note, it's way easier to get this data using YQL. See for example:
http://developer.yahoo.com/yql/console/?q=show%20tables&env=store://datatables.org/alltableswithkeys#h=SELECT%20*%20FROM%20yahoo.finance.options%20WHERE%20symbol%3D%27C%27%20AND%20expiration%3D%272011-09%27
Which gives y
Try to narrow it down:
from extension import Template
from extension import Syntax
from extension import processcmd
Which one fails? What is this "extension" package?
--
http://mail.python.org/mailman/listinfo/python-list
Thank you! My kids *love* it.
--
http://mail.python.org/mailman/listinfo/python-list
Probably the google maps routes will be faster (maybe using embedded webkit
window). However it requires internet connection.
See also http://www.scipy.org/Cookbook/Matplotlib/Maps
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
> How is it possible that the module exists and it's actually imported,
> and not found when I actually try to import something from it?
Do you have a local file/directory that is called sqlalchemy?
--
http://mail.python.org/mailman/listinfo/python-list
Greetings,
Is there an L.A. Python user group out there?
Thanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
As far as I see, the problem is not in the command line but in
system.cpu[i].workload = process[i] call tree.
Without seeing the code of SimObject and params I can't tell much more.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Seems like self.ptype is a type that has __init__ with no arguments (other than
self).
You can add "print type(self.ptype)" as first line of "convert" to see what
type it is (or place a breakpoint there).
--
http://mail.python.org/mailman/listinfo/python-list
If you want to view the variable, use the "p" (print) command. Then there is no
name clash.
--
http://mail.python.org/mailman/listinfo/python-list
IIRC mechanize can do that.
--
http://mail.python.org/mailman/listinfo/python-list
The working directory of the webserver is probably not the one of the script.
You should specify full path to the file. One way to do it is:
from os.path import dirname, join
filename = join(dirname(__file__), 'gri30.cti')
HTH
--
Miki Tebeka
http://pythonwise.blogspot.com
Don't specify it as an option, but as an argument.
If you're on a new version of python, you should probably use argparse.
--
http://mail.python.org/mailman/listinfo/python-list
http://www.isup.me/python.org ;)
--
http://mail.python.org/mailman/listinfo/python-list
Please use the subprocess module, it's the one who's actively maintained.
http://docs.python.org/library/subprocess.html#replacing-the-os-spawn-family
--
http://mail.python.org/mailman/listinfo/python-list
MKTest.getObj(data[0]) will return the same object on every call(with the same
data that was initialized 1'st time). Any Daten parameter after the 1'st call
is ignored.
--
http://mail.python.org/mailman/listinfo/python-list
Why not use the build in wx.FileDialog?
Also, have a look at the demo that comes with wxPython. It has an example with
a sortable list control.
--
http://mail.python.org/mailman/listinfo/python-list
In my box, there are some spaces (tabs?) before "Speed". IMO re.search("Speed",
line) will be a more robust.
--
http://mail.python.org/mailman/listinfo/python-list
wx.FileDialog shows files and directories. If you need the user to pick one,
this is the standard way. Otherwise, if you need custom view on the file system
then probably list control is the right way to go. Again, the demo has a
working example with sortable list control.
--
http://mail.python
You probably want wx.EVT_LEFT_DCLICK, see the ListCtrl demo in the wx demo.
--
http://mail.python.org/mailman/listinfo/python-list
You can use services like https://www.tropo.com/home.jsp or
http://www.twilio.com/
--
http://mail.python.org/mailman/listinfo/python-list
> since i'm mostly a new-bye for as regard databases, my idea is to use
> sqlite at the beginning.
>
> Is that ok?
I think sqlite3 makes sense since it's already there and has SQL interface.
> is there any general tutorial of how to start developing a database? i
> mean a general guide to data
You can see an example on how to use multiprocessing.Pool at
http://pythonwise.blogspot.com/2011/03/convert-oggs-to-mp3-fast-way.html
This is ogg -> mp3 but the same idea.
--
http://mail.python.org/mailman/listinfo/python-list
del sys.modules['my-module']
However if your module imported other modules, they'll still be there.
If there are references to objects your module created, they'll still be there.
A better option IMO is to use imp.find_module and then import.
--
http://mail.python.org/mailman/listinfo/python-lis
http://docs.python.org/library/shlex.html
--
http://mail.python.org/mailman/listinfo/python-list
There a many ways to do this, here's one:
from collections import namedtuple
Tree = namedtuple('Tree', ['feature', 'children'])
t = Tree(1, [Tree('hello', []), Tree(3, [])])
--
http://mail.python.org/mailman/listinfo/python-list
You can try
PYLIB = $(shell python -c 'import distutils.sysconfig; print
distutils.sysconfig.get_python_lib()')
(or pack the long command line in a script).
--
http://mail.python.org/mailman/listinfo/python-list
You can read data using win32com (ADODB?) and then write it to the desired
database using the right package (psycopg2 ...).
See example for reading data at
http://mail.python.org/pipermail/python-win32/2006-March/004420.html
--
http://mail.python.org/mailman/listinfo/python-list
There are two different problems. One is the medium to pass messages, sockets
are good but there are other options and depends on your requirement you need
to pick the best one.
The other is serialization format, here you have marshal, pickle, JSON, XML and
more.
For me JSON over sockets works
This is not tested, but maybe it'll work :)
def complete(self, text, state):
if text.startswith('config):
return self.config.complete(text, state)
return Cmd.complete(self, text, state)
--
http://mail.python.org/mailman/listinfo/python-list
Greetings,
Any recommendations for a book authoring system that supports the following:
1. Code examples (with syntax highlighting and line numbers)
2. Output HTML, PDF, ePub ...
3. Automatic TOC and index
4. Search (in HTML) - this is a "nice to have"
Can I somehow use Sphinx?
Thank
You can either work with datetime module (see datetime.datetime.strptime) or
with the time module (see time.strptime and time.mktime)
--
http://mail.python.org/mailman/listinfo/python-list
> My sort issue... as in this doesn't work
> >>> if x.sort == y.sort:
You're missing the () to make it a function call.
Also list.sort() returns none, it mutates the original list.
You can either
sorted(x) == sorted(y)
or
set(x) == set(y)
--
http://mail.python.org/mailman/listinfo/python-l
> > set(x) == set(y)
>
> Duplicates cause issues in the set() version:
You're right, I stand corrected.
--
http://mail.python.org/mailman/listinfo/python-list
You probably need to accumulate a buffer and try to decode it, when succeeded
return the object and read more. See example below (note that for sockets
select might be a better option for reading data).
import json
from time import sleep
def json_decoder(fo):
buff = ''
decode = json.JSO
I've tried several things. So far vim (with line numbers) to show the code and
then ipython to run it works great.
Another option I tried once was Aptana, since most people in my company know
eclipse this was good for them. It has most (all?) of the features you
mentioned above.
--
http://mail
I'd say go with option 1. Pass the window handler (or DC) to the rendered
thread.
To overcome the GIL problem, you can use Py_BEGIN_ALLOW_THREADS
(see http://docs.python.org/release/1.5.2/api/threads.html)
--
http://mail.python.org/mailman/listinfo/python-list
What was the term you used to search? Since
http://pypi.python.org/pypi/ingress/0.1.1 seems to fit your description.
--
http://mail.python.org/mailman/listinfo/python-list
> >>> s = "{0} {1} {2} {3}"
> >>> s.format(1, 2, 3, 4)
> '1 2 3 4'
Or even
In [4]: fmt = '{0} {1} {2} {3}'.format
In [5]: print(fmt(1, 2, 3, 4))
1 2 3 4
--
http://mail.python.org/mailman/listinfo/python-list
Is there Google groups search not good enough?
(groups.google.com/group/comp.lang.python)
Also, can you give an example of the code and an input file?
--
http://mail.python.org/mailman/listinfo/python-list
Another option is to copy the data to the a location under the new chroot and
register a new lookup functions
(http://docs.python.org/library/codecs.html#codecs.register). This way you can
save some memory.
--
http://mail.python.org/mailman/listinfo/python-list
> I'm wondering if there's a utility for Python to build GUIs.
IIRC the Qt builder can generate Python code.
--
http://mail.python.org/mailman/listinfo/python-list
> can anybody point out a situation where you really need
> itertools.filterfalse() ?
Sometimes you get the predicate as a parameter to another function. This way if
you want to filter out things you can easily do it. Other language (such as
Clojure) have a "complement" function that removes th
> I would like to know what are the top 10 most important features (on your
> opinion) in python.
You're in luck :) Raymond Hettinger just gave "Python is Awesome" keynote at
PyCon. You can view the slides at
https://speakerdeck.com/pyconslides/pycon-keynote-python-is-awesome, video will
follow
> I'm trying to update to both 2.7.3 and Numpy 1.7.0.
Updating Python is from python.org
If you're on 64bit windows, see http://www.lfd.uci.edu/~gohlke/pythonlibs/
--
http://mail.python.org/mailman/listinfo/python-list
> Fianlly my cgi .py script doesnt produce any more errors, i think i ahve
> correct them but it present a blank screen
> Any idea why?
Please post the code to the script, otherwise we can't help you.
--
http://mail.python.org/mailman/listinfo/python-list
> I can catch the exception, but don't see any way to tell which row caused the
> problem. Is this information obtainable, short of retrying each row one by
> one?
One way to debug this is to wrap the iterable passed to executemany with one
that remembers the last line. Something like:
cla
error. Why do you need the 2'nd part.
In general, we're moving to list/generator comperhension over map/filter.
Something like:
print(sum(x*x for x in xrange(10**6) if (x*x)%2))
HTH,
Miki
--
http://mail.python.org/mailman/listinfo/python-list
> I can't even read that mess... three nested lambda?
I have to say this and other answers in this thread seem not that friendly to
me.
The OP said it's a newbie question, we should be more welcoming to newcomers.
--
http://mail.python.org/mailman/listinfo/python-list
> I have a CSV file with 20 rows and 12 columns and I need to store it as a
> matrix.
If you can use pandas, the pandas.read_csv is what you want.
--
http://mail.python.org/mailman/listinfo/python-list
> Pynguin is a python-based turtle graphics application.
I wonder why Pynguin does not get more traction in the teaching sector. Looks
ideal for teaching kids.
--
http://mail.python.org/mailman/listinfo/python-list
Greetings,
I'm trying to find a way to have json emit float('NaN') as 'N/A'.
I can't seem to find a way since NaN is a float, which means overriding
"default" won't help.
Any simple way to do this?
Thanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
>> I'm trying to find a way to have json emit float('NaN') as 'N/A'.
> No. There is no way to represent NaN in JSON. It's simply not part of the
> specification.
I know that. I'm trying to emit the *string* 'N/A' for every NaN.
--
http://mail.python.org/mailman/listinfo/python-list
> >>> I'm trying to find a way to have json emit float('NaN') as 'N/A'.
> Easiest way is probably to transform your object before you try to write
Yeah, that's what I ended up doing. Wondered if there's a better way ...
Thanks,
--
Miki
--
http://mail.python.org/mailman/listinfo/python-list
[Roland]
> yes, there is: subclass+extend the JSON-encoder, see pydoc json.
Please read the original post before answering. What you suggested does not
work since NaN is of float type.
--
http://mail.python.org/mailman/listinfo/python-list
> > You understand that this will result in a chunk of text that is not JSON?
> I think he means something like this:
> >>> json.dumps([float('nan')])
> '["N/A"]'
That's exactly what I mean :)
--
http://mail.python.org/mailman/listinfo/python-list
> I want to use spline interpolation function from SciPy in an application and
> at the same time, I don't want the end user to have to install SciPy
> separately.
You can pack you application with py2exe, pyinstaller ... and then they won't
even need to install Python.
Another option (which is
401 - 500 of 521 matches
Mail list logo