enhanced map function

2011-03-11 Thread Patrick
Hi,

The build-in map functions looks quite nice but it requests the
iterables to be of the same length or otherwises will file with None
(most of time fails the function). Just wondering if there are already
enhancement work done with it?

I did some simple code but it will handle list without nesting only.
I am looking for examples that could hand input of "a = [2,3], b=4"
and "a=[1,[2,3],4], b=[5,[6,7,8],9,10]". That means if the nesting
structure is the same, enhanced map function will automatically extend
the shorter list using the last element. Or if the input is a constant
at the first point, then it feeds constant value to all other iterable
combinations.

Any tip is appreciated.
-Patrick.



def Add (x,y):
return x+y


def Bmap(function, *args):
num = 0
for iter in args[0:]:
if num < len(iter):
num = len(iter)

nlist=[]
for i in range(0,num,1):
fargs = []
for iter in args[0:]:
if len(iter) > i:
fargs.append(iter[i])
continue
fargs.append(iter[-1])

nlist.append(function(*fargs))
return nlist

if __name__ == '__main__':
a = [2,3]
b = [4,5,8]
print Bmap (Add, a, b)
-- 
http://mail.python.org/mailman/listinfo/python-list


Calling C++ Modules in Python

2011-03-11 Thread Patrick
Hi,

I saw in the Beginner document that "•Is easily extended by adding new
modules implemented in a compiled language such as C or C++. ".

While to my investigation, it seems not that easy or did I miss
something?

boost python (C++ libraries need to be re-compiled with written
wrappers again?).
SWIG  (It works by taking the declarations found in C/C++ header and
using them to generate the wrapper code that scripting languages need
to access the underlying C/C++ code).

Thanks
-Patrick
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Calling C++ Modules in Python

2011-03-11 Thread Patrick
Thanks Sophie for the information. Yes, right now I am not certain
about what I am going to use for I was hoping for a "non-intrusive"
way to expose existing C++ libraries to python. However, both
solutions (BOOST, SWIG) listed here require the recompilation of
libraries?! It is ok for small applications but will be hard for big
software from big companies. The reason is that even companies are
willing to rebuild their own libraries with those wrappers or
decorations added(though needs approves from all sorts of
departments :)), they can't force their 3rd-party developers/users.
Correct me if I am wrong.

Cheers,
-Patrick.

On Mar 11, 4:32 pm, Sophie Sperner  wrote:
> Hi Patrick,
>
> I'm using SWIG in my project. C++ code is wrapped and can be used in
> python as custom module.
> You should create a swig module.i file to describe headers upon which
> that module will be built.
>
> You should be certain about what you are going to use - boost library,
> swig or something else, try it and if any problems post here :)
>
> Yours,
> Sophie

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: enhanced map function

2011-03-17 Thread Patrick
Steven,

Thanks for the info of itertools. It is a great start for me. Overall,
I agree with you that it is really the user data needs to be sorted
out. However, novice users may need help on certain patterns such as
"a=[1,[2,3],4], b=[5,[6,7,8],9,10]". We could just draw our line
saying that similarly nested inputs could be adjusted even though the
members aren't exactly on one-to-one mapping and we won't getting any
deeper for complicated cases such as "a = [1, 2, [3, 4]]; b = [1, [2,
[3,4]], [4,5], 6]".

> enhanced_map([1, [2,3, [4,5], 6], 7], [8, [7,6, [5,4], 3], 2])
> should be the same as
> map([1, 2, 3, 4, 5, 6, 7], [8, 7, 6, 5, 4, 3, 2])

I don't expect the drop. The original nested structure is very
important.


> What do you expect to happen if the sub-sequences don't match up exactly?
> E.g. a = [1, 2, [3, 4]]; b = [1, [2, 3], 4]
>
> What do you expect to happen if the shorter list is empty?
> E.g. a = [1, 2, [3, 4], 5]; b = [1, 2, [], 3]

There are modes called "shortest" and "longest" (and
"AllCombination"/"Cross" which is more complex).

For case  a = [1, 2, [3, 4],4]; b = [1, [2, 3], 4,5]

shortest:
   a will be adjusted to [1, [3, 4],4]
   b will be adjusted to [1, [2, 3],4]

longest:
   a will be adjusted to [1, 2,[3, 4],4,4]
   b will be adjusted to [1, 1,[2, 3],4,5]

As I said previously, the enhance_map function will only handle
limited "unmatch" cases and the line will need to be drawn carefully.

Thanks
-Patrick.
-- 
http://mail.python.org/mailman/listinfo/python-list


calculating download speed from .pcap file

2013-10-11 Thread patrick

hi,

im looking for a way to calculate download speed for a http connection 
inside my .pcap file.

but doing even a simple read with dpkt doesnt really work.

import pcap, dpkt
import socket

pcapReader = dpkt.pcap.Reader(file("http-download.pcap"))
for ts, data in pcapReader:
print ts, len(data)
eth = dpkt.ethernet.Ethernet(data)
print eth


according to this howto: 
http://jon.oberheide.org/blog/2008/10/15/dpkt-tutorial-2-parsing-a-pcap-file/
it should output something reable, but instead i get ascii art. nothing 
readable.


ts and len(data) work as expected, the first is the timestamp and the 
second the packet length.


any idea whats wrong?



ive had some progresss with scapy when working with icmp, but when 
reading the TCP sequence numbers output differs from wireshark/tcpdump. 
posted it here: 
http://thread.gmane.org/gmane.comp.security.scapy.general/4952



greets
--
https://mail.python.org/mailman/listinfo/python-list


Pickle virtual machines implemented in other languages?

2013-10-29 Thread Patrick

Hi Everyone

I was just wondering if anyone had tried to implement a pickle virtual 
machine in another language? I was thinking that it might make for a 
nice little form of cross language IPC within a trusted environment.


--
https://mail.python.org/mailman/listinfo/python-list


jack audio connection kit

2007-09-25 Thread patrick
hello everyone,

is there a way to make python output audio in jack:
http://jackaudio.org/

jack is the best audio solution for linux, mac and lately windows. i 
found 1 project called pyjack, but the author remove the software from 
his website.

that would be neat!
pat




-- 
http://mail.python.org/mailman/listinfo/python-list


stopping a while True: with the keyboard

2007-09-25 Thread patrick
hi all,

i am looking for a way to break a while True: when pressing "s" on my 
keyboard. how can i do this?

pat
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: stopping a while True: with the keyboard

2007-09-25 Thread patrick
i don't want to quit my program only get out from a while True:
also i want to use only 1 key like s.

pat



Benjamin wrote:
> On Sep 25, 8:19 pm, patrick <[EMAIL PROTECTED]> wrote:
>   
>> hi all,
>>
>> i am looking for a way to break a while True: when pressing "s" on my
>> keyboard. how can i do this?
>>
>> pat
>> 
>
> Ctrl-C
>
>   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: jack audio connection kit

2007-09-25 Thread patrick
found the perfect solution (for linux at least) : gstreamer!
http://pygstdocs.berlios.de/

pat
-- 
http://mail.python.org/mailman/listinfo/python-list


call for collaboration (python / freesound)

2007-09-30 Thread patrick
hi,

i have an idea, who doesn't have?

the technologies required:
gtk+
glade
gobject
Queue
threading
gstreamer (GNonLin)
config

here's the result of my week-end trying to understand how it's working:
http://www.workinprogress.ca/pd/freesound.png

the idea is to make a bridge from python to freesound:
http://freesound.iua.upf.edu/

here's the class i used:
http://www.leonard-ritter.com/freesound_integration

there's some already solutions, but they are linked to an application:
http://www.jokosher.org/screenshots
http://trac.zeitherrschaft.org/aldrin/wiki/AldrinScreenshots

if anybody is interested into "working / helping" on this project, i 
would be very happy.

cheers guys,
pat


-- 
http://mail.python.org/mailman/listinfo/python-list


scraping with urllib2

2010-01-26 Thread Patrick
I'm trying to scrape the attached link for the price listed $99.99:
http://bananarepublic.gap.com/browse/product.do?cid=41559&vid=1&pid=692392

I can see the price if I view the source(I even turned off java and
javascript), but when I use urllib2, the price doesn't show up.

Is there another library other than urllib2 that would work?


-- 
http://mail.python.org/mailman/listinfo/python-list


[JOB] Look for a Full Time Plone Developer

2013-06-06 Thread Patrick Waldo
Hi All,

Please take a look at a new job opportunity for Python/Plone developers.

Patrick Waldo,
Project Manager
Decernis <http://decernis.com/>

*Job Description: Full Time Python/Plone Developer*

We are looking for a highly motivated and self-reliant developer to work on
systems built with Plone in a small, but lively team.  Our ideal candidate
is not afraid to roll up their sleeves to tackle complex problems with
their code as well as offer innovative solutions at the planning and design
stages.  The position also calls for both rapid prototyping for client
meetings, maintaining current systems and fulfilling other tasks as
necessary.

 This position requires experience in Plone administration, setting up
backup and failover instances, optimizing the ZODB, testing and
documentation.   The job also entails creating clean user interfaces,
building forms and integrating with Oracle.

 The position will begin with a six-month trial period at which point
full-time employment will be re-evaluated based on performance.  The
candidate will be able to choose hours and work remotely, but must meet
deadlines and report progress effectively.



*Key Skills*

·  At least 3 years of Plone and Python development

·  At least 3 years web development (HTML, CSS, jQuery, etc.)

·  Server administration (Apache)

·  Oracle integration (cx_Oracle, SQLAlchemy, etc.)

·  Task oriented and solid project management skills

·  Data mining and data visualization experience is a plus

·  Java or Perl experience is a plus

·  Proficient English

·  Effective communication



*About Decernis*

Decernis is a global information systems company that works with industry
leaders and government agencies to meet complex regulatory compliance and
risk management needs in the areas of food, consumer products and
industrial goods.  We hold ourselves to high standards to meet the
technically challenging areas that our clients face to ensure
comprehensive, current and global solutions.  Decernis has offices in
Rockville, MD and Frankfurt, Germany as well as teams located around the
world.

For more information, please visit our website: http://www.decernis.com.

*Contact*

Please send resume, portfolio and cover letter to Cynthia Gamboa, *
cgam...@decernis.com*.

Decernis is an equal opportunity employer.
-- 
http://mail.python.org/mailman/listinfo/python-list


Upgrading Python with NumPy, SciPy and Mayavi in a Rocks 6.0 cluster

2013-01-13 Thread Patrick Haley

Hi,

We are looking for some guidance in installing an upgraded
Python on our cluster.  Our cluster was installed with Rocks 6.0,
is running CentOs 6.2, and has python-2.6.6, gcc-4.4.6.  We
would like to install an upgraded version of Python along with
the following modules

NumPy
Scipy   (which will require a compatible version of the Atlas libraries)
Mayavi  (which will require a compatible version of vtk)

We were wondering if anyone has experience in installing these
packages, what are the best combinations of compatible versions,
what other upgrades will be needed (e.g. will we need to
upgrade the gnu compilers to install the latest versions) and
where these should be installed (local disks, /share/apps, other?).

A little more background, our students are currently working
with a local installation using

Python-2.7.1
numpy-1.5.1
scipy-0.9.0b1
Mayavi-3.4.0
ATLAS-3.8.3
vtk-5.4

We would like to install these packages in a more
appropriate, cluster-wide area and upgrade these
packages as appropriate.  We are also aware of a
Rocks python roll which contains python-2.7.2 and
an upspecified version of NumPy (is it possible to
find out which version, before installing the roll?).

Thanks

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Pat Haley  Email: 
pha...@mit.edu
Center for Ocean Engineering Phone:(617) 253-6824
Dept. of Mechanical Engineering Fax:(617) 253-8125
MIT, Room 5-213  
http://web.mit.edu/phaley/www/
77 Massachusetts Avenue
Cambridge, MA  02139-4301

-- 
http://mail.python.org/mailman/listinfo/python-list


ctypes and twain_32.dll

2011-04-30 Thread Patrick Vrijlandt
Hi,

I'm trying to access TWAIN from python 3.2 on Vista, using ctypes. I'm
stuck at line 2:

PythonWin 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit
(Intel)] on win32.
>>> from ctypes import *
>>> windll.twain_32
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python32\lib\ctypes\__init__.py", line 410, in __getattr__
dll = self._dlltype(name)
  File "C:\Python32\lib\ctypes\__init__.py", line 340, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 1114] Een initialisatieroutine van de dynamic
link library (DLL-bestand) is mislukt

[Yes, I'm Dutch. It says: An initialisation procedure of the DLL has
failed]

This is from a .NET / TWAIN example on http://www.codeproject.com:

As the TWAIN API is exposed by the Windows DLL, twain_32.dll, we have
to use the .NET DllImport mechanism for interop with legacy code. This
DLL has the central DSM_Entry(), ordinal #1 function exported as the
entry point to TWAIN. This call has numerous parameters, and the last
one is of variable type! It was found to be best if we declare
multiple variants of the call like:

[DllImport("twain_32.dll", EntryPoint="#1")]
private static extern TwRC DSMparent(
[In, Out] TwIdentity origin,
IntPtr zeroptr,
TwDG dg, TwDAT dat, TwMSG msg,
ref IntPtr refptr );

I suspect that initialisation may fail because of missing arguments,
but I see no way of sending any arguments. Also, contrary to the .NET
example,  I cannot express that the DLL entrypoint has ordinal 1. Of
course, I may be totally wrong!

I'm hoping for your suggestions!

TIA,

Patrick
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ctypes and twain_32.dll

2011-05-02 Thread Patrick Vrijlandt
On 2 mei, 20:56, "Michel Claveau -
MVP" wrote:
> Hi!
>
> On my system, thera are not "twain32.dll" or "twain_32.dll", but "twain.dll"
>
> @+
> --
> Michel Claveau

Hi,

I have both. They are correctly installed and working. ctypes gives a
different response if it cannot find the requested DLL.

Patrick
-- 
http://mail.python.org/mailman/listinfo/python-list


Dealing with name clashes in pypi

2011-05-22 Thread Patrick Sabin
I wanted to register my project (epdb) in pypi. Unfortunately there 
already exists a project with the same name. It is not possible for me 
to change the name of the project, because I used it in multiple 
writings. Any ideas how I can deal with the situation? Is it possible to 
register a project under a different name in pypi than the actual 
project name?


--
Patrick
--
http://mail.python.org/mailman/listinfo/python-list


Re: Dealing with name clashes in pypi

2011-05-23 Thread Patrick Sabin

On 2011-05-22 23:23, Terry Reedy wrote:

On 5/22/2011 2:34 PM, Patrick Sabin wrote:

I wanted to register my project (epdb) in pypi. Unfortunately there
already exists a project with the same name. It is not possible for me
to change the name of the project, because I used it in multiple
writings. Any ideas how I can deal with the situation? Is it possible to
register a project under a different name in pypi than the actual
project name?


I presume so. How would pypi know the 'actual' name?
However, there is a catalog sig list (mirrored as
gmane.comp.python.catalog) where you might get specific suggestions on
how to handle this.



Thanks for the tip. I will try it there.

-- Patrick
--
http://mail.python.org/mailman/listinfo/python-list


Compiling Python for iOS 11

2017-09-24 Thread Patrick Stinson
Has anyone successfully compiled python for iOS 11? I tried with 3.5.2 and 
3.6.2 and got the following errors:


turin:Python-3.6.2 patrick$ make
Makefile:9845: warning: overriding commands for target `.obj/_pickle.o'
Makefile:8855: warning: ignoring old commands for target `.obj/_pickle.o'
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
 -c -pipe -fwrapv -std=c99 -g -fPIC  -arch arm64  -arch x86_64 -Xarch_arm64 
-miphoneos-version-min=8.0 -Xarch_arm64 
-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk
 -Xarch_x86_64 -mios-simulator-version-min=8.0 -Xarch_x86_64 
-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.0.sdk
 -fobjc-nonfragile-abi -fobjc-legacy-dispatch -w -fembed-bitcode-marker 
-DQT_COMPILER_SUPPORTS_SSE2 -DNDEBUG -DPy_BUILD_CORE -DVERSION=\"3.6\" 
-DVPATH=\".\" -DPREFIX=\"/\" -DEXEC_PREFIX=\"/\" 
-DPYTHONPATH=\"/lib/python3.6\" -DPLATFORM=\"linux\" -I. 
-I../../../pyqt-sysroot-base/src/qt5/qtbase/mkspecs/common/uikit -I. -IInclude 
-I../../../pyqt-sysroot-base/src/qt5/qtbase/mkspecs/macx-ios-clang -o 
.obj/_scproxy.o Modules/_scproxy.c
Modules/_scproxy.c:65:17: error: 'SCDynamicStoreCopyProxies' is unavailable: 
not available on iOS
proxyDict = SCDynamicStoreCopyProxies(NULL);
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h:210:1:
 note: 
  'SCDynamicStoreCopyProxies' has been explicitly marked unavailable here
SCDynamicStoreCopyProxies   (
^
Modules/_scproxy.c:75:9: error: 'kSCPropNetProxiesExcludeSimpleHostnames' is 
unavailable: not available on iOS
kSCPropNetProxiesExcludeSimpleHostnames);
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h:1992:49:
 note: 
  expanded from macro 'kSCPropNetProxiesExcludeSimpleHostnames'
#define kSCPropNetProxiesExcludeSimpleHostnames 
kSCPropNetProxiesExcludeSimpleHostnames
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h:1991:26:
 note: 
  'kSCPropNetProxiesExcludeSimpleHostnames' has been explicitly marked 
unavailable here
extern const CFStringRef kSCPropNetProxiesExcludeSimpleHostnames
__OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
 ^
Modules/_scproxy.c:89:21: error: 'kSCPropNetProxiesExceptionsList' is 
unavailable: not available on iOS
kSCPropNetProxiesExceptionsList);
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h:1985:41:
 note: 
  expanded from macro 'kSCPropNetProxiesExceptionsList'
#define kSCPropNetProxiesExceptionsList kSCPropNetProxiesExceptionsList
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h:1984:26:
 note: 
  'kSCPropNetProxiesExceptionsList' has been explicitly marked unavailable 
here
extern const CFStringRef kSCPropNetProxiesExceptionsList
__OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
 ^
Modules/_scproxy.c:176:17: error: 'SCDynamicStoreCopyProxies' is unavailable: 
not available on iOS
proxyDict = SCDynamicStoreCopyProxies(NULL);
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h:210:1:
 note: 
  'SCDynamicStoreCopyProxies' has been explicitly marked unavailable here
SCDynamicStoreCopyProxies   (
^
Modules/_scproxy.c:185:9: error: 'kSCPropNetProxiesHTTPEnable' is unavailable: 
not available on iOS
kSCPropNetProxiesHTTPEnable,
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h:2048:37:
 note: 
  expanded from macro 'kSCPropNetProxiesHTTPEnable'
#define kSCPropNetProxiesHTTPEnable kSCPropNetProxiesHTTPEnable
^
/Appli

choice of web-framework

2017-10-22 Thread Patrick Vrijlandt

Hello list,

I would like your recommendation on the choice of a web framework.

The project is completely new, there are no histories to take into 
account (current solutions are paper-based). The website involves 
questionnaires that will be developed, filled out and stored. Users are 
not programmers or developers. They should be authenticated. Version 
control is required. Internationalization is not an issue. I expect that 
the project will add additional requirements and complexity later on 
that I can not foresee yet. I'm targeting a single deployment (maybe a 
second on a development machine). I usually work on Windows, but Linux 
can be considered.


I'm not afraid to learn a (=one) new framework (that would actually be 
fun) but trying out a lot of them is not feasible. My current goal is a 
demonstration version of the project as a proof of concept. I may want 
to hand it over to a commercial solution at that stage.


I'm an experienced python programmer but not an experienced web 
developer. A few years ago I read some books about Zope and Plone, but 
never did serious development with those. I currently maintain an 
intranet site in MoinMoin. I assume Zope could still be a potential 
choice, but it may have lost the vibrancy of a few years ago. Also, I 
would not know which version to choose (Zope 4, BlueBream, or something 
like Grok). The problem seems too complicated for micro frameworks like 
bottle of Flask. Django could be the next alternative.


Finally, for a new project, I would not like to be confined to Python 2.7.

What are your ideas?

Thanks in advance,

--
Patrick
--
https://mail.python.org/mailman/listinfo/python-list


Re: choice of web-framework

2017-10-22 Thread Patrick Vrijlandt

Op 22-10-2017 om 14:05 schreef Tim Chase:

> I'm not sure what "version control is required" means in this
> context.  Is this version-control of the users' answers? Or
> version-control of the source code.  If it's the source code, the web
> framework won't help you there, but git, mercurial, or subversion are
> all good/reasonable choices.  If you want to version your user's
> answers or other aspects of your application, you'll need to design
> it into your app.  There might be plugins/modules to facilitate this
> on either side of the Django / Flask/Bottle/SQLAlchemy divide.

The version control I was referring to, is indeed users' data. I plan to 
use Mercurial for the source code. The questionnaires being developed 
will go through many revisions. The questionnaires being filled in, are 
enough work to have a provision for mistakes. The idea is much like the 
"revert" option that MoinMoin and other wikis provide.


--Patrick
--
https://mail.python.org/mailman/listinfo/python-list


Python/New/Learn

2022-05-04 Thread Patrick 0511
Hello, I'm completely new here and don't know anything about python. Can 
someone tell me how best to start? So what things should I learn first?
-- 
https://mail.python.org/mailman/listinfo/python-list


pygame.midi input/output not working

2022-12-21 Thread Patrick EGLOFF
HI,
Some time ago I wrote a small software using pygame.midi
It worked just fine with Win10/ python 3.9 / SDL 2.0.14 / pygame 2.0.1

I had to change my computer and now I installed Win10 / Python 3.11.1 / SDL
2.0.18 / pygame 2.1.2

The following instructions don't work anymore, making the IDE stop
execution :

my_input = pygame.midi.Input(MidiDeviceIn)
midi_out = pygame.midi.Output(MidiDeviceOut)

Does someone have a suggestion?

Thanks,

-- 
Patrick Egloff
email : pegl...@gmail.com
Web page : http://www.egloff.eu
-- 
https://mail.python.org/mailman/listinfo/python-list


Fwd: pygame.midi input/output not working

2022-12-21 Thread Patrick EGLOFF
Hi Thomas,

Thanks for the answer AND solution !
That was it... shame on me, I didn't notice this warning.

I uninstalled 3.11.1 and installed 3.10.9, and my software is back to live
!

Now I have to figure out another problem. I will make another post about
this serial weird behavior.

Thanks for making my day !
Patrick

Le mer. 21 déc. 2022 à 23:27, Thomas Passin  a écrit :

> On 12/21/2022 4:32 PM, Patrick EGLOFF wrote:
> > HI,
> > Some time ago I wrote a small software using pygame.midi
> > It worked just fine with Win10/ python 3.9 / SDL 2.0.14 / pygame 2.0.1
> >
> > I had to change my computer and now I installed Win10 / Python 3.11.1 /
> SDL
> > 2.0.18 / pygame 2.1.2
> >
> > The following instructions don't work anymore, making the IDE stop
> > execution :
> >
> > my_input = pygame.midi.Input(MidiDeviceIn)
> > midi_out = pygame.midi.Output(MidiDeviceOut)
> >
> > Does someone have a suggestion?
>
> The pygame web site says this:
>
> "Pygame still does not run on Python 3.11"
>
> Also from the same page:
>
> "Make sure you install python with the "Add python to PATH" option
> selected. This means that python, and pip will work for you from the
> command line."
>
> See https://www.pygame.org/wiki/GettingStarted#Pygame%20Installation
>
> So what to do until pygame runs in Python 3.11?  I'd install an earlier
> version of Python.  You can have several versions on your machine at the
> same time.  Remember, you have to install all the required packages with
> each version of Python - they don't use each other's code or libraries.
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 
Patrick Egloff
email : pegl...@gmail.com
Web page : http://www.egloff.eu


-- 
Patrick Egloff
email : pegl...@gmail.com
Web page : http://www.egloff.eu
-- 
https://mail.python.org/mailman/listinfo/python-list


Pyserial problem

2022-12-22 Thread Patrick EGLOFF
Hi all,

I use Python 3.10.9 and Pyserial 3.5 on a Win10 machine.

I'm sending datas via an USB port to a device that accept commands in the
form of  : cmd;
The device receives and reacts to the commands sent, and it should reply
with an ACK of the same kind.

But looking with a COM port sniffer, nothing is sent back.

I checked that everything is working with PUTTY and even MINITERM, and
everything is just fine, the device is responding correctly.

I have set the flow control to different values, as well as setting the RTS
and DTR high or low with no change.
Normally, the device works without any flow control, and CTS + DTR high.

I checked with MINITERM, that the flow control and control lines have the
same state.

I'm a bit surprised and stucked.
Can someone help ?
Thanks,
-- 
Patrick Egloff
email : pegl...@gmail.com
Web page : http://www.egloff.eu
-- 
https://mail.python.org/mailman/listinfo/python-list


Patrick Sheehan: Major Issues with Python

2023-03-26 Thread Patrick Sheehan
Hello,
I have been working with the attached book (See photo) to try to learn
Python and so far it has been a complete nightmare trying to get python
installed and operating correctly.  I have received a plethora of error
messages and consulted youtube videos and chat groups to try to remedy the
issues.  I am using a computer that is running Windows 10.  I have
installed, and un-installed several versions of Python and was able to
complete the first two lessons in the attached book, but could not complete
lesson 3 (Turtledemo)...Some of the error messages I have received
include:  "This app cannot run on your PC"; "Unable to initialize device
PRN"; “Python is not recognized as an internal or external command”:
"Python was not found: run without arguments to install from Microsoft
Store, or disable this shortcut from settings mange, app execution
aliases:"...I have been at this for 4 days now at least three hours each
day...Any information or help you can provide would be greatly
appreciated.  Additionally, I do have PyCharm installed (As you can tell, I
am a beginner), is PyCharm the same thing as Python?  Thank you in advance!

Respectfully,
Patrick Sheehan
-- 
https://mail.python.org/mailman/listinfo/python-list


Building manylinux wheels & auditwheel

2016-10-21 Thread Patrick Young
Hello,

I've been exploring building manylinux wheels and trying to use auditwheel
to vendorize my shared libraries.  Essentially, I can't seem to get
"auditwheel repair" to fix up my wheel that has some dependencies that need
to be packed up.

I've described my problem at https://github.com/pypa/auditwheel/issues/52,
but to summarize, I've built the demo wheel found at
https://github.com/pypa/python-manylinux-demo.  From inside the container,
after the wheel's have been built but not repaired, I run

auditwheel -vv show python_manylinux_demo-1.0-cp27-cp27mu-linux_x86_64.whl

which gives the following:

DEBUG:auditwheel.wheel_abi:{}
DEBUG:auditwheel.policy.versioned_symbols:Required symbol versions: {}
INFO:auditwheel.wheel_abi:{
"manylinux1_x86_64": {
"priority": 100,
"libs": {}
},
"linux_x86_64": {
"priority": 0,
"libs": {}
}
}
DEBUG:auditwheel.wheel_abi:external referene info
DEBUG:auditwheel.wheel_abi:{
"manylinux1_x86_64": {
"priority": 100,
"libs": {}
},
"linux_x86_64": {
"priority": 0,
"libs": {}
}
}

python_manylinux_demo-1.0-cp27-cp27mu-linux_x86_64.whl is consistent
with the following platform tag: "manylinux1_x86_64".

The wheel references no external versioned symbols from system-
provided shared libraries.

The wheel requires no external shared libraries! :)

but unzipping that wheel and runnning ldd tells a different story

[root@1965501e43ea pymanylinuxdemo]# ldd extension.so
linux-vdso.so.1 =>  (0x7ffc52bd8000)
libcblas.so.3 => /usr/lib64/atlas/libcblas.so.3 (0x7fdcd467e000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x7fdcd4461000)
libc.so.6 => /lib64/libc.so.6 (0x7fdcd4108000)
libatlas.so.3 => /usr/lib64/atlas/libatlas.so.3 (0x7fdcd3813000)
libm.so.6 => /lib64/libm.so.6 (0x7fdcd358f000)
/lib64/ld-linux-x86-64.so.2 (0x5619467b3000)

Any help would be greatly appreciated! I'm experiencing the same thing
across the board with other builds I've been trying to manylinuxize.


Thanks!

-Patrick
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Work between multiple processes

2017-01-06 Thread Patrick Zhou
On Thursday, January 5, 2017 at 5:49:46 PM UTC-5, Irmen de Jong wrote:
> On 4-1-2017 23:14, zxpat...@gmail.com wrote:
> > Hi everyone,
> > 
> > I ran into a case that I need to create a work process of an application 
> > (Jython so has to call using java.exe) which will collect the data based on 
> > what main process indicates. 
> > 
> > (1) I tried multiprocessing package, no luck. Java.exe can't be called from 
> > Process class?
> > 
> > (2) I tried subprocess. subprocess.communicate function will wait for the 
> > work process to terminate so to return.
> > 
> >  
> > either (1) or (2) doesn't work out well. Please suggest.  Global system 
> > queue?
> > 
> > Thanks,
> > Patrick.
> > 
> 
> 
> Is it a requirement that the workdf process is also Jython?
> 
> If not: you could spawn a Python subprocess that hosts a Pyro4 daemon.
> Utilizing the Pyrolite java client library you can call methods in it from the
> java/jython side.  (Unfortunately it is not yet possible (due to jython
> incompatibilities) to use the full Pyro4 library on the Jython side as well).
> Not sure if it meets your set of requirements but have a look at
> http://pythonhosted.org/Pyro4/
> http://pythonhosted.org/Pyro4/pyrolite.html
> 
> 
> Irmen


Thanks Irmen. I think that could be the solution I am looking for. The main 
process will be native python so it can be used to host a pyro daemon even with 
lock. The jython will be a subprocess that takes the daemon's uri and use the 
pyrolite library to make the communication. The only trouble is that I will 
have to involve two more java libraries but I don't think it is a big of deal. 
Will try it and post the source code if possible.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Work between multiple processes

2017-01-10 Thread Patrick Zhou
Hi Irmen,

I have successfully got it to work with both side as python but so far having 
trouble with pyrolite.jar which is downloaded from 
https://mvnrepository.com/artifact/net.razorvine/pyrolite/4.4


Having simple codes as:

public static void main(String[] args) {
//System.out.println("Hello world");

try {
String uri = 
"PYRO:obj_12a65b09f95f4ee9bec5958f819ced45@localhost:64404";
PyroURI pyURI = new PyroURI(uri);
PyroProxy pyroP = new PyroProxy(pyURI);

Object result = pyroP.call("getDst");
String message = (String) result;
System.out.println("result message=" + message);
pyroP.close();
}
catch (IOException e1) {
System.out.println(e1.getMessage());
}
catch (PickleException e2)
{
System.out.println(e2.getMessage());
}
catch (PyroException e3)
{
System.out.println(e3.getMessage());
}
}

which "getDst" works on Java but hangs on handshake() in the call function. 

Any thought? Thanks. -P
-- 
https://mail.python.org/mailman/listinfo/python-list


Building on windows and installing to prefix

2018-10-24 Thread Patrick Stinson
Hello!

I am having trouble finding out how to build python from source and then 
install it to a path prefix, as you can on unix. I have looked at the options 
in “PCBuild\build.bat -h” and in readme.txt, and on google, but no dice.

I have VS 2017.

Thanks!
-Patrick
-- 
https://mail.python.org/mailman/listinfo/python-list


Relative import cannot find .so submodule?

2020-01-11 Thread Patrick Stinson
I have a module named rtmidi, and its C submodule named rtmidi/_rtmidi. The 
distills script builds successfully and successfully creates a build/lib dir 
with a rtmidi dir in it and the submodule file 
rtmidi/_rtmidi.cpython-36dm-darwin.so. I have set PYTHONPATH to this lib dir, 
but rtmidi/__init__.py gives the following error:

Traceback (most recent call last):
  File "main.py", line 6, in 
from pkmidicron import MainWindow, util, ports
  File "/Users/patrick/dev/pkmidicron/pkmidicron/__init__.py", line 1, in 

from .mainwindow import *
  File "/Users/patrick/dev/pkmidicron/pkmidicron/mainwindow.py", line 2, in 

    import rtmidi
  File "/Users/patrick/dev/pkmidicron/pyrtmidi/build/lib/rtmidi/__init__.py", 
line 1, in 
from ._rtmidi import *
ModuleNotFoundError: No module named 'rtmidi._rtmidi’

How does the module finder work in the import system? I assume ti automatically 
resolves the name _rtmidi.cpython-36dm-darwin.so to _rtmidi? I didn’t have any 
luck reading the docs on the import system.

Thanks!
-Patrick
-- 
https://mail.python.org/mailman/listinfo/python-list


Equivalent of "make install" for Python on windows?

2020-07-10 Thread Patrick Stinson
Building python from source on windows is straightforward enough with 
PCBuild/build.bat. But it seems as though the resulting distribution that runs 
from these standard build dirs ends up sort of incomplete and/or fragmented - 
at least for what I am used to on *NIX.

Binaries are in ./PCBuild/platform instead of ./bin, there is no pip, then 
get-pip.py installs the pip module but puts the pip script in ./Scripts. And 
other things…

Is there some kind of install step that I am missing? It’s fine if this is just 
a matter of adjusting to a non-standard distribution config, but I have always 
had the feeling that the distribution doesn’t really work correctly.

Cheers,
-Patrick
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Equivalent of "make install" for Python on windows?

2020-07-10 Thread Patrick Stinson
Oh right, and another example: 

The binary names for debug builds have a _d suffix, but modules like pip (which 
I assume can only be installed with get-pip.py) expect them not to have this 
suffix. Once I started copying lots of .exe and .lib files around just to make 
the distribution work I started to think I was missing something.

Cheers,
-Patrick

> On Jul 10, 2020, at 8:01 AM, Patrick Stinson  wrote:
> 
> Building python from source on windows is straightforward enough with 
> PCBuild/build.bat. But it seems as though the resulting distribution that 
> runs from these standard build dirs ends up sort of incomplete and/or 
> fragmented - at least for what I am used to on *NIX.
> 
> Binaries are in ./PCBuild/platform instead of ./bin, there is no pip, then 
> get-pip.py installs the pip module but puts the pip script in ./Scripts. And 
> other things…
> 
> Is there some kind of install step that I am missing? It’s fine if this is 
> just a matter of adjusting to a non-standard distribution config, but I have 
> always had the feeling that the distribution doesn’t really work correctly.
> 
> Cheers,
> -Patrick

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python's garbage collection was Re: Python reliability

2005-10-14 Thread Patrick Down
Paul Rubin wrote:

> I haven't been keeping up with this stuff in recent years so I have a
> worse concern.  I don't know whether it's founded or not.  Basically
> in the past decade or so, memory has gotten 100x larger and cpu's have
> gotten 100x faster, but memory is less than 10x faster once you're out
> of the cpu cache.  The mark phase of mark/sweep tends to have a very
> random access pattern (at least for Lisp).  In the old days that
> wasn't so bad, since a random memory access took maybe a couple of cpu
> cycles, but today it takes hundreds of cycles.  So for applications
> that use a lot of memory, simple mark/sweep may be a much worse dog
> than it was in the Vax era, even if you don't mind the pauses.

You pay a price for CG one way or the other.  In Python the price is
spread out among a bunch of increment and decrement operations in the
code.  For mark and sweep the price is a big operation done less often.
 My understanding from reading about GC implementations is that
reference counting can exhibit poor cache performance because
decrementing a reference can lead to a chain of decrements on objects
that can be laid out in memory in a fairly random fashion.  Mark and
sweep can be a better cache performer since it's memory access will
tend to be more linear.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: newbie question concerning formatted output

2005-11-29 Thread Patrick Down
>>> a = [str(i) for i in range(0,17)]
>>> for i in range(0,len(a),3):
... print " ".join(a[i:i+3])
...
0 1 2
3 4 5
6 7 8
9 10 11
12 13 14
15 16

-- 
http://mail.python.org/mailman/listinfo/python-list


Does a function like isset() exist in Python?

2005-06-22 Thread Patrick Fitzsimmons
Hi,

I'm sure I should know this, but I can't find it in the manual.

Is there a function in Python like the function in PHP isset()?  It
should take a variable name and return True or False depending on
whether the variable is initialized.

Thanks for any help,
Patrick
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 304 - is anyone really interested?

2005-06-22 Thread Patrick Maupin
Skip Montanaro wrote:

> I wrote PEP 304, "Controlling Generation of Bytecode Files":
...
> If someone out there is interested in this functionality
> and would benefit more from its incorporation into the
> core, I'd be happy to hand it off to you.

I am quite interested in this PEP.

What, exactly, would the recipient of this "hand-off" have to do?  Does
it primarily have to do with resolution of the issues listed in the
PEP?

BTW, my use case for this PEP is different than the PEP's given
rationale -- in general, I (and the people I work with) keep our source
trees completely separate from (and parallel to) our object trees.
This obviates the need for .cvsignore, makes "make clean" a much easier
proposition, makes it easier to generate and test/compare slightly
different object sets (just use an environment variable to change the
build target directory), and reduces the filtration required to get
usable output from simple source file greps.  The main fly in the
ointment right now is .pyc files -- they tend to pop up whereever there
is a little script (or more accurately, of course, whereever there is a
multiple-module script :), and the current choices for dealing with
them as special cases, e.g. zip files, copying all sub-modules over to
the build tree before importing them, manually reading the files and
compiling them, etc.,  are all rather unappealing.

>From my perspective, the lack of PEP 304 functionality in the standard
distribution is hampering World Domination, since the littering of
source directories with compiled .pyc files is yet another excuse for
some of my compatriots to keep using Perl.  In fact, I have to be very
careful how I introduce Python scripts into this environment lest I
anger someone by polluting their source tree.

Note that for my current purposes (as described above, and in contrast
to the original rationale behind the PEP) sys.bytecodebase is much more
important than PYTHONBYTECODEBASE (because my few scripts can set up
sys.bytecodebase quite easily themselves).  Since it would seem that
most of the security concerns would derive from the PYTHONCODEBASE
environment variable, it would be an interesting exercise to try to
figure out how many potential users of this PEP want it for my purposes
and how many want it for the original purpose.  I would think not
adding the environment variable would be less contentious from a
security/backward-compatibility standpoint, but possibly more
contentious from a
lack-of-new-useful-functionality-that-could-not-be-easily-implemented-in-an-add-on-package
standpoint.


Regards,
Pat

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 304 - is anyone really interested?

2005-06-23 Thread Patrick Maupin
Thomas Heller wrote:

> Although I was not interested originally, I think that's
> a use case I also have.  Optional config files, which
> should not be compiled to .pyc or .pyo.  Only removing
> the .py file doesn't have the expected effect
> if a .pyc and/or .pyo if is left.


I also think that if nobody has the same use-case as envisioned by the
original PEP, we should probably step back and rethink how it should be
implemented.  The original PEP envisioned the installation of
third-party .py file libraries without their corresponding .pyc files
into directories for which the eventual script user had no
write-access.  As more people become coginzant of the correct way to
install Python libraries, I think this use-case fades in importance.

The key distinction between this older use-case and the currently
envisioned use-case is that the former assumes third-party code, and
the latter assumes that the control over .pyc generation is desired by
the _author_ of some python code, rather than merely the _installer_ of
some python code.  In this latter case, environment variables are not
strictly necessary, because the top-level script could do whatever it
needs to control .pyc generation, from inside Python itself.

> AFAIK, it is not possible to define empty env vars on Windows.

You make a good point about null environment variables.  I think the
original PEP was fairly *nix-centric, both in that aspect, and in the
aspect of requiring the value of bytecodebase to be the "root" of the
file system.  This might not have the desired results in all cases on
Windows.

Regards,
Pat

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PEP 304 - is anyone really interested?

2005-06-24 Thread Patrick Maupin
John Roth wrote:

>  I'd like to suggest a different mechanism, at least for packages
> (top level scripts don't generate .pyc files anyway.)  Put a system
> variable in the __init__.py file.  Something like __obj__ = path
> would do nicely. Then when Python created the __init__.pyc file,
> it would insert a back link __src__ entry.

I like the kernel of that proposal.  One down-side is that you might
wind up compiling at least __init__.py on every execution which imports
the package (to extract the object directory variable __obj__).   If
you had automatic .pyc directory creation and updating of __obj__ for
sub-packages, you would only take the hit of recompiling the topmost
__init__.py in a package tree.

I'm not as sure about the use of the backlink -- it seems to introduce
a little bit of a chicken/egg problem to be able to import from a .pyc
directory which knows where its .py directory is -- how did the .pyc
files get there in the first place?  There must have been a separate
compilation phase at some point, and while I can envision a use case
for that, I don't have a pressing need for it.

I'm also not sure about the extent of the changes required to the
import/compile mechanism.  It seems the importer would have  to be able
to defer writing out the .pyc file until after the execution of the
body of the __init__.py module.

Finally, I think you're dismissing one of the discussed use-cases out
of hand :)  Although it is true that a top-level script will not
generate a .pyc file, a slightly more generic use of the term "script"
could encompass a top-level module and one or more sub-modules in the
same directory.  If the script is run infrequently enough and the
sub-modules are small enough, in some cases I would certainly love to
be able to tell Python "Please don't litter this directory with .pyc
files."

Assuming the deferral of writing .pyc files until after module
execution is is not a problem (for all I know it already works this
way, but I wouldn't know why that would be), I think a slightly more
fleshed out (but still very green) proposal might be:

1) When a module is first imported, the importing module's globals are
searched for an __obj__ identifier.  The importer will make a local
copy of this variable during the import:

objdir = passed_globals.get('__obj__', None)

2)  If a .pyc/.pyo file is found in the same directory as the
coresponding .py file:
   a) If the .pyc/.pyo is newer, it is loaded and executed and we
are done; or
   b)  objdir is set to None to indicate that we should regenerate
.pyc/.pyo in situ.

Step b) could be debated, but I think it would be very confusing to
have an out-of-date .pyc file in a directory, with the "real" .pyc file
elsewhere...

3) If this is a package import and objdir is a non-null string, objdir
is updated to include the package name.  Something like:

if is_package and objdir: objdir = os.path.join(objdir, package_name)

4) If objdir is a non-null string and there is a newer readable
.pyc/.pyo file at the directory indicated in objdir, that file is
loaded and executed and we are done.

5) The source file is compiled into memory.

6) If objdir is not None the globals of the newly created module are
updated such that __obj__= objdir.

7) The module body is executed, including performing any sub-imports.

8)  The module's __obj__ is now examined to determine if and where to
write the module's .pyc/.pyo file:

if __obj__  does not exist -- write to same directory as .py (same as
current behavior)

if __obj__ exists and is a non-empty string and is equal to objdir
(e.g. not modified during initial module body execution) -- write to
the named directory.  Create the leaf directory if necessary (e.g. for
package imports).

if __obj__ exists and is the empty string, do not create a .pyc file.
This allows author suppression of writing .pyc files.

if __obj__ exists but is not equal to objdir, create the leaf directory
if it does not exist, but do not write the .pyc file.   This is an
optimization for the case where __init__.py specifies a new package
subdirectory -- why write out a .pyc file if you won't know where it is
until you re-compile/re-execute the source .py file?  You'll never be
able to make use of the .pyc file and maybe you don't even have write
privileges in the directory.   Even though this is true, we still want
to create the directory, so that sub-package imports don't have to
create multiple directory levels.

I think this mechanism would allow for the following:

- Control of package/subpackage .pyc file location with a single line
of code in the topmost __init__ file, at the small cost of recompiling
the __init__ file on every program execution.

- Control of _all_  .pyc file location (unless overridden for a given
package as described above) from a top-level script.  In this case,
regular .pyc files would wind up _inside_ the __obj__ directory of the
package which first imported them, and package .pyc files would wind up
in a subdi

Re: formatted xml output from ElementTree inconsistency

2005-06-24 Thread Patrick Maupin
Jarek Zgoda wrote:

> Why want you to read an XML document "by hand"? It's a "machine related"
> data chunk.
>

I see this attitude all the time, and frankly I don't understand it.
Please explain why XML is in ASCII/unicode instead of binary.  Is it
because it is easier for a machine to parse?  No, I thought not.  It's
obviously so humans can read it.  The next question is:  why is
arbitrary whitespace allowed?  Is that to make it easier for machines
to parse?  Is it any easier for machines to generate arbitrary
whitespace than it would have been for them to always insert, e.g., a
single space?  No, I thought not there as well.

> Document formatting should be done by means of CSS and/or XSL stylesheet.

He's not formatting the (rendered) document -- he's just formatting the
raw data to make it more readable in an editor.  You could use CSS/XSL,
and then selectively add whitespace without actually affecting the
rendering.  Alternatively, as you point out, it is a "machine related"
data chunk -- some XML documents are never even destined for human
eyes, _except_ for debugging.  For some of those documents, CSS and XSL
are just a waste of CPU cycles.

Regards,
Pat

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: formatted xml output from ElementTree inconsistency

2005-06-24 Thread Patrick Maupin
Dennis Bieber wrote:

> Off hand, I'd consider the non-binary nature to be because the
> internet protocols are mostly designed for text, not binary.

A document at http://www.w3.org/TR/REC-xml/ lists "the design goals for
XML".

One of the listed goals is "XML documents should be human-legible and
reasonably clear".

To your point, the very _first_ listed goal (if order means anything in
this list) is "XML shall be straightforwardly usable over the
Internet", so it's reasonable to assume "the non-binary nature to be
because the internet protocols are mostly designed for text, not
binary."

But this assumption turns cause and effect on its head.  It is
perfectly feasible to pass binary data through every known internet
protocol (with a little simplistic encoding), and is done all the time.
 The real next question is: why ARE the internet protocols "mostly
designed for text, not binary"?

SMTP, for example, was designed at a time when memory, bandwidth, and
CPU cycles were all at a premium, and MTAs were coded using fairly
low-level constructs in C where parsing was a pain in the rear.  Even
so, the developers decided to use relatively free-formatted ASCII in
the protocol.  To follow your theory to its logical conclusion, they
must have wasted all that bandwith, all those CPU cycles, all that
memory, all that disk space, and all that effort writing parsing code
because of yet another underlying mechanism which was "designed for
text."

On that account, your theory is correct, but only when you realize the
underlying mechanism which is "designed for text" is the human brain,
which has to try to make sense of all this mess when things aren't
quite interoperating properly.

Regards,
Pat

-- 
http://mail.python.org/mailman/listinfo/python-list


Bad Math

2005-07-01 Thread Patrick Rutkowski
I started reading a python book today, one example was:

>>> 4 / (2.0 + 3)
0.8

My input/output was:

>>> 4 (2.0 + 3)
0.80004

Something smells fishy here... whats up?

--python 2.4.1
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: $6 into $1000ands this actually works!

2005-07-01 Thread Patrick Maupin
Thomas wrote:

> TURN $6 INTO $15,000 IN ONLY 30 DAYS...HERES HOW!

> $ REMEMBER, IT IS 100% LEGAL! DON'T PASS THIS UP!

and I thought this was about some new currency/decimal module
implementation which remembers units and does the conversion
correctly...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bad Math

2005-07-02 Thread Patrick Rutkowski
On 7/2/05, Brian van den Broek <[EMAIL PROTECTED]> wrote:
> Patrick Rutkowski said unto the world upon 02/07/2005 00:12:
> > That's... annoying, to say the least. And my number 4/5 was a rational
> > number too; I can understand how when doing 1/3 things can get funky.
> > Really though... 4/5 = 0.8 right on the nose, whats up?
> >
> > I read that 
> > http://www.python.org/doc/faq/general.html#why-are-floating-point-calculations-so-inaccurate
> > I'd like to find out more, is there anyway for this issue to be
> > circumvented? That "is within a reasonable limit check" seams like way
> > too much just to get a proper result from something simple like 4/5.
> >
> >
> 
> Hi Patrick,
> 
> my quick piece of code became something I thought might someday be
> useful. So, I expanded it with tests, and sanity checks, etc. It
> doesnt' yet have the full functionality I'd like (see docstrings), but
> I won't get to fixing it anytime real soon.
> 
> So, in case you are interested, it is attached. It allows you to
> compute the value of a rational[*] as expressed in any base, 1 < base
> < 37, to arbitrary precision.
> 
> [*] Any n/m, -3 < n/m < 3. Subject to some restrictions, a greater
> range. (These are the limits on functionality mentioned above.)
> 
> It is in need of some re-organization, and I'm no skilled programmer,
> so certainly don't take it as an ideal model :-)
> 
> It also got me to look into decimal for the first time :-)
> 
> Anyway, attached.
> 
> Best,
> 
> Brian vdB
> 
> 
> 
> 
> #! /usr/bin/env python
> #
> # rationalconverter.py
> # Copyright 2005 Brian van den Broek
> # [EMAIL PROTECTED]
> #
> # Version 0.1
> # 02-Jul-2005  05:29:20
> #
> # Released under the GPL
> # (If you would prefer some other licence, feel free to write and ask: we
> # will most probably be able to work something out -- I picked the GPL
> # because safe and well-known, not out of a deep ideological commitment.)
> 
> ##
> #
> # rationalconverter.py -- functions to convert rationals to other bases
> # Copyright (C) 2005 Brian van den Broek
> #
> # This program is free software; you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> # the Free Software Foundation; either version 2 of the License, or
> # (at your option) any later version.
> #
> # This program is distributed in the hope that it will be useful,
> # but WITHOUT ANY WARRANTY; without even the implied warranty of
> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> # GNU General Public License for more details.
> #
> # You can view the GNU General Public License at:
> # <http://www.gnu.org/licenses/gpl.txt>.
> #
> # Alternatively, you can obtain a copy by writing to:
> # The Free Software Foundation, Inc.
> # 59 Temple Place - Suite 330
> # Boston, MA 02111-1307
> # USA
> #
> ##
> 
> 
> import math, string
> from decimal import Decimal
> 
> # values is the set of 36 'digits' for use in representing the converted 
> value.
> values = string.digits + string.uppercase
> 
> def float_to_base_n(numerator, denominator, base, precision):
> '''_> string expressing target in base to desired precision
> 
> numerator and denominator must be integral values, denominator must also 
> be
> non-zero.
> base must be an integral value greater than 1 and less than 37.
> precision must be an integeral value greater than 0.
> 
> The function returns a string representing numerator/denominator in base
> to the desired level of precision.
> 
> NB Temporary limitations:
> Presently, it can handle neither numerator/denominator values greater
> than 10, nor combinations of numerator, denominator, and base values
> such that numerator/denominator > base. (The original code was written
> just to deal with decimal fractions in [0, 1] and thus cannot cope 
> with
> these cases.) Future plan. Patches welcomed.
> 
> >>> float_to_base_n(4, 5, 3, 20)
> '0.210121012101210121012'
> '''
> 
> error, msg = _sanity_check_for_float_to_base_n(numerator, denominator,
>base, precision)
> if error:
> raise error, msg
> 
> base = Decimal(base)
> 

HTML Conventions

2005-07-04 Thread Patrick Rutkowski
I couldn't help but make an even better list in reference to this thread: 
http://mail.python.org/pipermail/python-list/2005-July/288678.html

Type   Convention 
Example
funtion
action_with_underscores
find_all
variable   noun_with_underscores  

curr_index
constant   NOUN_ALL_CAPS  

ALLOWED_RNA_PAIRS
class  MixedCaseNoun  
RnaSequence
public propertyMixedCaseNoun  
IsPaired
private property   
_noun_with_leading_underscore  
_is_updated
public method  
mixedCaseExceptFirstWordVerb   
stripDegenerate
private method 
_verb_with_leading_underscore  
_check_if_paired
really private data
__two_leading_underscores  
__delegator_object_ref
parameters matching property   SameAsProperty 
__init__(data, Alphabet=None)
factory function   MixedCase  
InverseDict
module 
lowercase_with_underscores 
unit_test

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Trapping user logins in python ( post #1)

2005-07-04 Thread Patrick Rutkowski
On Monday 04 July 2005 13:49, Jeff Epler wrote:
> I don't know of a portable way for an inetd-style daemon to "listen" for
> user logins.
>
> On some systems (including RedHat/Fedora and debian), you may be able to
> use PAM to do this.  (pam modules don't just perform authentication,
> they can take other actions.  As an example, pam_lastlog "prints the
> last login on successful login".  I'm not sure what priviledge a pam
> module has when it executes.
>
> A more standard way to do this would be to place lines in /etc/profile
> /etc/csh.login and so forth for any other shells used on your system.
> RedHat-style systems have an /etc/profile.d where you can drop a file
> that will be executed at login, too.  This will, of course, be executed
> with the user's privilege level.  Another problem with this approach is
> that /etc/profile is executed for a "login shell", but a graphical login
> is not a login shell.
>
> Jeff

If you'd like to hack and slash your way to a solution then you could run 
"watch who" in a daemon that then sed's the output to your desired format and 
then dumps it to a log/notification.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Good starterbook for learning Python?

2005-07-05 Thread Patrick Rutkowski
On Tuesday 05 July 2005 11:32, Lennart wrote:
> Hi everybody,
>
> Can someone advice me with the following issue: i want to learn python in
> my summer vacation (i try to ...:-) So, a good start is buying a good book.
> But wich? There are many ...
>
> I'm living in the Netherlands and I prefer a book from bol.com (see link)
> because i've to order more books by them. I'm familiar with html & php and
> basic (in the good old days). It has to be a newbie book, but not a book
> what i don't need anymore when i've got some skills. I.e. the learning
> curve of the book should be linear. A kind of book wich i could use as a
> novice.
>
> Search here for python (sorry, there's no short link)
> http://www.nl.bol.com/is-bin/INTERSHOP.enfinity/eCS/Store/nl/-/EUR/BOL_Brow
>seCatalog-View;sid=nyuhO3sz8k2hODn5OfqfDJvrcywRiGQwhPU=?Section=BOOK_EN&Cate
>goryContent=NJqR5Kpb0soAAADqmW%2eZypJb&OpenCategory=HwqR5Kpb8AUAAADqVW6ZypJb
>&CategoryLeftpanel=BOOK_EN%2eCATEGORY&Secondary=YES&Template=BOL_sub
>cat_BOOK_EN_1476

I've taken up learning python over the summer as well. 
http://safari.oreilly.com/ is a website which sells IT books for on-line 
viewing. They charge $20 per month and you get 10 "slots" on your books 
shelf. You can get anybook you want, some books take 2 slots, some 1 slot, 
and some are even half of a slot.

They have a 14 day free trial as well, its really worth giving it a whirl 
(free books!!). It's totally 100% over the internet (or in downloadable PDF 
format), its so great.
-- 
http://mail.python.org/mailman/listinfo/python-list


how to imput usernames and passwords??

2005-07-25 Thread Patrick Thorstenson








I am scripting GIS (mapping) applications at a very very basic level... One of our processes involves
connecting to an Oracle database. When the connection occurs, we are prompted
to enter a user name and password. That is OK when we are sitting right there
but we want to be able to enter this information automatically so these update
scripts can run at night.  Is there a way
I can have Python tell Oracle what the username and password is? Thanks for
your help in advance.  

 

Patrick Thorstenson

GIS Specialist

Montezuma County

(970) 564-9298 ext 4169

[EMAIL PROTECTED]

 






-- 
http://mail.python.org/mailman/listinfo/python-list

deleting a file and looping

2005-07-25 Thread Patrick Thorstenson








I can delete a folder OK using os.remove
as long as its empty. I am having difficulty deleting
the same folder when there are files in it. I have tried os.removedirs
and shutil.rmtree as well but no luck. What am I
missing? 

 

 

 

Patrick Thorstenson

GIS Specialist

Montezuma County

(970) 564-9298 ext 4169

[EMAIL PROTECTED]

 






-- 
http://mail.python.org/mailman/listinfo/python-list

trying to access Oracle

2005-07-27 Thread Patrick Thorstenson








I am trying to access Oracle using the cx_Oracle
module. I can login to Oracle OK, but I am at a loss as to how I should then
access the specific table I need so that I can join it to our county parcel
layer using the “make table view” tool. I have scoured the internet
looking for any examples and have found little that makes sense (to me). Can
anyone help? The table I need is called ASR.TEMP_OWNERSHIP. The password,
username, and TNS is all “asr”.


I’m not quite to the point where I can think for
myself and improvise with python.  

 

 

# Import system modules

import cx_Oracle, win32com.client

 

# Create the Geoprocessor object

gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")

 

 

connection = cx_Oracle.connect("asr", "asr", "asr")   

 

 

# Local variables...     ###HERE IS WHERE I DON’T
KNOW WHAT TO DO###

    ..below is the path to temp_ownership..

ASR_JOIN = (connection, "Database Connections\\ASR_Temp_GIS.odc\\ASR.TEMP_OWNERSHIPGIS")

 

 

gp.MakeTableView_management (ASR_JOIN)

 

 

 

 

Patrick Thorstenson

[EMAIL PROTECTED]

 






-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Moinmoin config

2005-08-17 Thread Patrick Down
Mark wrote:
> Hi,
>
> I have Moinmoin 1.3.4 installed and working on Linux RHEL3.0.  However,
> all screen elements are lined up on the left hand side.   How can I get
> it displayed like the wiki at:

Well, this is probably a better question for the moin lists but
I have seen this behavior before.  I would check the

data_underlay_dir = './underlay/'

line in your wikiconfig.py file.  If it's not getting the right
templates it won't format the page right.   This is the only
advice I can give.  Beyond this I don't know what else you can
try.

>
> http://moinmoin.wikiwikiweb.de/HelpOnConfiguration
>
> instead of this ? ->
>
> LANShieldOS Release Notes
> Search:
>
> * MarkRuedy
> * UserPreferences
>
> * HelpOnEditing
> * HelpContents
> * HelpForBeginners
> * UserPreferences
>
> * FrontPage
> * RecentChanges
> * FindPage
> * HelpContents
>
> * Edit
> * Show Changes
> * Get Info
> * Subscribe
> *
> 
> FrontPage

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Possible improvement to slice opperations.

2005-09-04 Thread Patrick Maupin
> After considering several alternatives and trying out a few ideas with a
>   modified list object Bengt Richter posted, (Thank You), I think I've
> found a way to make slice operation (especially far end indexing)
> symmetrical and more consistent.

I don't know that it makes it more consistent.  I could be persuaded,
but it would have to be by real-life examples with calculated slice
indices and stride.  I do this thing all the time, and find the current
rules simple and very consistent.  Occasionally, I might wish that
things were a little different, but there is always a workaround.  I
would have to see some real code examples, of sufficient scope to see
that there are fewer workarounds with this proposal than with the
current implementation.

FWIW, there is a reasonable workaround for the case where the indices
might be negative and you would like zero or greater to mean 'end of
list'.  If "x" is the index variable, you can use the expression (x<0
and x or None) for the index value in the slice.  If you find yourself
doing this often, you can write a little function for it -- def
EndIndex(x): return x<0 and x or None.

But in real code, I fear you might need a similar helper function for
similar issues with your change.  I just don't know what those are
without more thought.

Regards,
Pat

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Possible improvement to slice opperations.

2005-09-05 Thread Patrick Maupin
> No one has yet explained the reasoning (vs the mechanics) of the
> returned value of the following.
>
> L = range(10)
> L[3::-1]
>
> So far every attempt to explain it has either quoted the documents which
> don't address that particular case, or assumed I'm misunderstanding
> something, or implied it isn't neccisary to do.
>
> It's quite easy to get me to change my mind on something, just show me a
> convincing explanation and I will. :)

Once I saw this, I was surprised, because slices currently work exactly
like I would and do expect on this example, so I now have to admit that
I didn't read your original post fully and carefully.  I have gone back
to look to figure out what you don't like and what you want, and I am
very surprised.

To me, your way reeks of black magic -- if there is a sign on the
stride, then strange and wondrous transformations happen.  I think it
is conceptually (and probably programatically) much simpler the way it
is.

In any case, you asked for a rationale.  I'll give you mine:

>>> L = range(10)
>>> L[3:len(L):-1] == [L[i] for i in range(3,len(L),-1)]
True
>>>

If you manage somehow to hange that 'True' to a 'False', I'll
personally be extremely unhappy.

Regards,
Pat

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Possible improvement to slice opperations.

2005-09-05 Thread Patrick Maupin

I previously wrote (in response to a query from Ron Adam):

> In any case, you asked for a rationale.  I'll give you mine:
>
> >>> L = range(10)
> >>> L[3:len(L):-1] == [L[i] for i in range(3,len(L),-1)]
> True
> >>>

After eating supper, I just realized that I could probably make my
point a bit clearer with a slightly longer example:

>>> L = range(10)
>>> for stride in [-3, -2, -1, 1, 2, 3]:
... for start in range(len(L)):
... for end in range(len(L)):
... P = L[start:end:stride]
... Q = [L[i] for i in range(start, end, stride)]
... assert P == Q

This should never fail with an assertion error.  You will note that it
shows that, for non-negative start and end values, slicing behavior is
_exactly_ like extended range behavior.  I cannot imagine that the
behavior of range() could be made any more intuitive than it already
is.  I personally feel that your proposed change makes slice() less
intuitive on its own, but even if I did not feel that way, your way
would have to be SIGNIFICANTLY better than the current way to make it
worthwhile to make slice() behavior differ from that of range().

In my initial skimming of your post, I originally thought you were
referring to negative start and end values.  Negative start and end
values will sometimes cause issues, but the utility of their current
implementation far outweighs the few corner cases which (as I mentioned
in an earlier post) sometimes need some special case logic to deal
with.

Regards,
Pat

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Possible improvement to slice opperations.

2005-09-06 Thread Patrick Maupin

Ron Adam wrote:

>> This should never fail with an assertion error.  You will note that it
>> shows that, for non-negative start and end values, slicing behavior is
>> _exactly_ like extended range behavior.

> Yes, and it passes for negative start and end values as well.

Umm, no:

.>> for stride in [-3, -2, -1, 1, 2, 3]:
... for start in range(-1,len(L)):
... for end in range(-1,len(L)):
... P = L[start:end:stride]
... Q = [L[i] for i in range(start, end, stride)]
... assert P==Q, [start, end, stride, P, Q]
...
Traceback (most recent call last):
  File "", line 6, in ?
AssertionError: [-1, 0, -3, [9, 6, 3], []]

> Thanks again, this pretty much explains why slices opperate the
> way they do.  And it explains why the edge case's happen as well I think.

You're welcome.

Regards,
Pat

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Proposal: add sys to __builtins__

2005-09-06 Thread Patrick Maupin
Sybren Stuvel wrote:

> A programming language should not be ambiguous. The choice
> between importing a module and calling a function should not
> depend on the availability of a (local) variable.

Yeah, this behavior would be as ambiguous as if we had a system-defined
search-path for modules, where you might get one module or another
depending on the path order.  Oh, wait -- we have one of those.

> The question is not if it's possible or not - in principle, everything
> is possible. The question is if it is desirable.

Exactly.  So it pays to try to understand what the payoff might be, and
I always try to be open-minded about that (although I sometimes fail
miserably in this goal).  In the case of sys.path, the payoff is that a
Python application has a small chance of running on a completely
different system.  In the case of automagic importation, the only
payoff I have seen discussed is that some people would be happier with
a little less typing.

The thing I always find baffling is that people who find it hard to
type "import sys" seem to find it quite easy to write eight paragraphs
explaining why it's bad to have to type "import sys."

Regards,
Pat

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: global variables shared across modules

2005-09-09 Thread Patrick Maupin

MackS wrote:
> print "inside fun(): " + global_var
...
> How can I get the changed value to "persist" in such a way that it
> isn't reset when control leaves fun()? Why is it even reset in the
> first place? After all, the module has already been imported (and the
> initialization of global_var executed) *before* fun() runs, right?
>
> Any clarification and help in solving this would be great

It _does_ persist and it _isn't_ reset.  Try:

import shared
print shared.global_var

at the end of your program, and you will see that you have bound the
identifier global_var in your main program to the same immutable object
that the identifier global_var in shared was bound to, and then you
_changed_ the identifier global_var in shared to point to a different
object.

-- 
http://mail.python.org/mailman/listinfo/python-list


fdups: calling for beta testers

2005-02-25 Thread Patrick Useldinger
Hi all,
I am looking for beta-testers for fdups.
fdups is a program to detect duplicate files on locally mounted 
filesystems. Files are considered equal if their content is identical, 
regardless of their filename. Also, fdups ignores symbolic links and is 
able to detect and ignore hardlinks, where available.

In contrast to similar programs, fdups does not rely on md5 sums or 
other hash functions to detect potentially identical files. Instead, it 
does a direct blockwise comparison and stops reading as soon as 
possible, thus reducing the file reads to a maximum.

fdups has been developed on Linux but should run on all platforms that 
support Python.

fdups' homepage is at http://www.homepages.lu/pu/fdups.html, where 
you'll also find a link to download the tar.

I am primarily interested in getting feedback if it produces correct 
results. But as I haven't been programming in Python for a year or so, 
I'd also be interested in comments on code if you happen to look at it 
in detail.

Your help is much appreciated.
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: fdups: calling for beta testers

2005-02-26 Thread Patrick Useldinger
John Machin wrote:
(1) It's actually .bz2, not .bz (2) Why annoy people with the
not-widely-known bzip2 format just to save a few % of a 12KB file?? (3)
Typing that on Windows command line doesn't produce a useful result (4)
Haven't you heard of distutils?
(1) Typo, thanks for pointing it out
(2)(3) In the Linux world, it is really popular. I suppose you are a 
Windows user, and I haven't given that much thought. The point was not 
to save space, just to use the "standard" format. What would it be for 
Windows - zip?
(4) Never used them, but are very valid point. I will look into it.

(6) You are keeping open handles for all files of a given size -- have
you actually considered the possibility of an exception like this:
IOError: [Errno 24] Too many open files: 'foo509'
(6) Not much I can do about this. In the beginning, all files of equal 
size are potentially identical. I first need to read a chunk of each, 
and if I want to avoid opening & closing files all the time, I need them 
open together.
What would you suggest?

Once upon a time, max 20 open files was considered as generous as 640KB
of memory. Looks like Bill thinks 512 (open files, that is) is about
right these days.
Bill also thinks it is normal that half of service pack 2 lingers twice 
on a harddisk. Not sure whether he's my hero ;-)

(7)
Why sort? What's wrong with just two lines:
! for size, file_list in self.compfiles.iteritems():
! self.comparefiles(size, file_list)
(7) I wanted the output to be sorted by file size, instead of being 
random. It's psychological, but if you're chasing dups, you'd want to 
start with the largest ones first. If you have more that a screen full 
of info, it's the last lines which are the most interesting. And it will 
produce the same info in the same order if you run it twice on the same 
folders.

(8) global
MIN_FILESIZE,MAX_ONEBUFFER,MAX_ALLBUFFERS,BLOCKSIZE,INODES
That doesn't sit very well with the 'everything must be in a class'
religion seemingly espoused by the following:
(8) Agreed. I'll think about that.
(9) Any good reason why the "executables" don't have ".py" extensions
on their names?
(9) Because I am lazy and Linux doesn't care. I suppose Windows does?
All in all, a very poor "out-of-the-box" experience. Bear in mind that
very few Windows users would have even heard of bzip2, let alone have a
bzip2.exe on their machine. They wouldn't even be able to *open* the
box.
As I said, I did not give Windows users much thought. I will improve this.
And what is "chown" -- any relation of Perl's "chomp"?
chown is a Unix command to change the owner or the group of a file. It 
has to do with controlling access to the file. It is not relevant on 
Windows. No relation to Perl's chomp.

Thank you very much for your feedback. Did you actually run it on your 
Windows box?

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: fdups: calling for beta testers

2005-02-26 Thread Patrick Useldinger
John Machin wrote:
Yes. Moreover, "WinZip", the most popular archive-handler, doesn't grok
bzip2.
I've added a zip file. It was made in Linux with the zip command-line 
tool, the man pages say it's compatible with the Windows zip tools. I 
have also added .py extentions to the 2 programs. I did however not use 
distutils, because I'm not sure it is really adapted to module-less scripts.

You should consider a fall-back method to be used in this case and in
the case of too many files for your 1Mb (default) buffer pool. BTW 1Mb
seems tiny; desktop PCs come with 512MB standard these days, and Bill
does leave a bit more than 1MB available for applications.
I've added it to the TODO list.
The question was rhetorical. Your irony detector must be on the fritz.
:-)
I always find it hard to detect irony by mail with people I do not know. ..
Did you actually run it on your
Windows box?

Yes, with trepidation, after carefully reading the source. It detected
some highly plausible duplicates, which I haven't verified yet.
I would have been reluctant too. But I've tested it intensively, and 
there's strictly no statement that actually alters the file system.

Thanks for your feedback!
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: fdups: calling for beta testers

2005-02-26 Thread Patrick Useldinger
Serge Orlov wrote:
Or use exemaker, which IMHO is the best way to handle this
problem.
Looks good, but I do not use Windows.
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: fdups: calling for beta testers

2005-02-27 Thread Patrick Useldinger
John Machin wrote:
I've tested it intensively
"Famous Last Words" :-)
;-)
(1) Manic s/w producing lots of files all the same size: the Borland
C[++] compiler produces a debug symbol file (.tds) that's always
384KB; I have 144 of these on my HD, rarely more than 1 in the same
directory.
Not sure what you want me to do about it. I've decreased the minimum 
block size once more, to accomodate for more files of the same length 
without increasing the total amount of memory used.

(2) There appears to be a flaw in your logic such that it will find
duplicates only if they are in the *SAME* directory and only when
there are no other directories with two or more files of the same
size. 
Ooops...
A really stupid mistake on my side. Corrected.
(3) Your fdups-check gadget doesn't work on Windows; the commands
module works only on Unix but is supplied with Python on all
platforms. The results might just confuse a newbie:
Why not use the Python filecmp module?
Done. It's also faster AND it works better. Thanks for the suggestion.
Please fetch the new version from http://www.homepages.lu/pu/fdups.html.
-pu
--
http://mail.python.org/mailman/listinfo/python-list


os.stat('')[stat.ST_INO] on Windows

2005-02-27 Thread Patrick Useldinger
What does the above yield on Windows? Are inodes supported on Windows 
NTFS, FAT, FAT32?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wishful thinking : unix to windows script?

2005-03-04 Thread Patrick Useldinger
John Leslie wrote:
Or does anyone have a python script which takes a standard unix
command as an argument and runs the pyton/windows equivalent on
windows?
There's not always an equivalent command.
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wishful thinking : unix to windows script?

2005-03-04 Thread Patrick Useldinger
Grant Edwards wrote:
If you install cygwin there almost always is.
If you install cygwin there's no need for what the OP describes.
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: Indexing strings

2005-03-04 Thread Patrick Useldinger
Fred wrote:
I am searching for a possibility, to find out, what the index for a
certain lettyer in a string is.
My example:
for x in text:
   if x == ' ':
  list = text[:  # There I need the index of the space the
program found during the loop...
Is there and possibility to find the index of the space???
Thanks for any help!
Fred
Use the index method, e.g.: text.index(' ').
What exactly do you want to do?
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: Indexing strings

2005-03-05 Thread Patrick Useldinger
Fred wrote:
That was exactely what I was searching for. I needed a program, that
chopped up a string into its words and then saves them into a list. I
think I got this done...
There's a function for that: text.split().
You should really have a look at the Python docs. Also, 
http://diveintopython.org/ and http://www.gnosis.cx/TPiP/ are great 
tutorials.

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: enum question

2005-03-05 Thread Patrick Useldinger
M.N.A.Smadi wrote:
does python support a C-like enum statement where one can define a 
variable with prespesified range of values?

thanks
m.smadi
>>> BLUE, RED, GREEN = 1,5,8
>>> BLUE
1
>>> RED
5
>>> GREEN
8
--
http://mail.python.org/mailman/listinfo/python-list


Re: function with a state

2005-03-06 Thread Patrick Useldinger
Xah Lee wrote:
globe=0;
def myFun():
  globe=globe+1
  return globe
The short answer is to use the global statement:
globe=0
def myFun():
  global globe
  globe=globe+1
  return globe
more elegant is:
globe=0
globe=myfun(globe)
def myFun(var):
  return var+1
and still more elegant is using classes and class attributes instead of 
global variables.

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: function with a state

2005-03-06 Thread Patrick Useldinger
Kent Johnson wrote:
globe=0
globe=myfun(globe)
def myFun(var):
  return var+1

This mystifies me. What is myfun()? What is var intended to be?
myfun is an error ;-) should be myFun, of course.
var is parameter of function myFun. If you call myFun with variable 
globe, all references to var will be replaced by globe inside function 
myFun.

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python docs [was: function with a state]

2005-03-10 Thread Patrick Useldinger
You don't understand the "global" statement in Python, but you do 
understand Software industry in general? Smart...
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread Patrick Useldinger
I wrote something similar, have a look at 
http://www.homepages.lu/pu/fdups.html.
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread Patrick Useldinger
Christos TZOTZIOY Georgiou wrote:
On POSIX filesystems, one has also to avoid comparing files having same (st_dev,
st_inum), because you know that they are the same file.
I then have a bug here - I consider all files with the same inode equal, 
 but according to what you say I need to consider the tuple 
(st_dev,ST_ium). I'll have to fix that for 0.13.

Thanks ;-)
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread Patrick Useldinger
Christos TZOTZIOY Georgiou wrote:
That's fast and good.
Nice to hear.
A minor nit-pick: `fdups.py -r .` does nothing (at least on Linux).
I'll look into that.
Have you found any way to test if two files on NTFS are hard linked without
opening them first to get a file handle?
No. And even then, I wouldn't know how to find out.
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] a program to delete duplicate files

2005-03-11 Thread Patrick Useldinger
Christos TZOTZIOY Georgiou wrote:
The relevant parts from this last page:
st_dev <-> dwVolumeSerialNumber
st_ino <-> (nFileIndexHigh, nFileIndexLow)
I see. But if I am not mistaken, that would mean that I
(1) had to detect NTFS volumes
(2) use non-standard libraries to find these information (like the 
Python Win extentions).

I am not seriously motivated to do so, but if somebody is interested to 
help, I am open to it.

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] a program to delete duplicate files

2005-03-11 Thread Patrick Useldinger
David Eppstein wrote:
You need do no comparisons between files.  Just use a sufficiently 
strong hash algorithm (SHA-256 maybe?) and compare the hashes.
That's not very efficient. IMO, it only makes sense in network-based 
operations such as rsync.

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] a program to delete duplicate files

2005-03-11 Thread Patrick Useldinger
Christos TZOTZIOY Georgiou wrote:
A minor nit-pick: `fdups.py -r .` does nothing (at least on Linux).
Changed.
--
http://mail.python.org/mailman/listinfo/python-list


Re: [perl-python] a program to delete duplicate files

2005-03-11 Thread Patrick Useldinger
David Eppstein wrote:
Well, but the spec didn't say efficiency was the primary criterion, it 
said minimizing the number of comparisons was.
That's exactly what my program does.
More seriously, the best I can think of that doesn't use a strong slow 
hash would be to group files by (file size, cheap hash) then compare 
each file in a group with a representative of each distinct file found 
among earlier files in the same group -- that leads to an average of 
about three reads per duplicated file copy: one to hash it, and two for 
the comparison between it and its representative (almost all of the 
comparisons will turn out equal but you still need to check unless you 
My point is : forget hashes. If you work with hashes, you do have to 
read each file completely, cheap hash or not. My program normally reads 
*at most* 100% of the files to analyse, but usually much less. Also, I 
do plain comparisons which are much cheaper than hash calculations.

I'm assuming of course that there are too many files and/or they're too 
large just to keep them all in core.
I assume that file handles are sufficient to keep one open per file of 
the same size. This lead to trouble on Windows installations, but I 
guess that's a parameter to change. On Linux, I never had the problem.

Regarding buffer size, I use a maxumim which is then split up between 
all open files.

Anyone have any data on whether reading files and SHA-256'ing them (or 
whatever other cryptographic hash you think is strong enough) is 
I/O-bound or CPU-bound?  That is, is three reads with very little CPU 
overhead really cheaper than one read with a strong hash?
It also depends on the OS. I found that my program runs much slower on 
Windows, probably due to the way Linux anticipates reads and tries to 
reduce head movement.

I guess it also depends on the number of files you expect to have 
duplicates of.  If most of the files exist in only one copy, it's clear 
that the cheap hash will find them more cheaply than the expensive hash.  
In that case you could combine the (file size, cheap hash) filtering 
with the expensive hash and get only two reads per copy rather than 
three.
Sorry, but I can still not see a point tu use hashes. Maybe you'll have 
a look at my program and tell me where a hash could be useful?

It's available at http://www.homepages.lu/pu/fdups.html.
Regards,
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
John Machin wrote:
Just look at the efficiency of processing N files of the same size S,
where they differ after d bytes: [If they don't differ, d = S]
PU: O(Nd) reading time, O(Nd) data comparison time [Actually (N-1)d
which is important for small N and large d].
Hashing method: O(NS) reading time, O(NS) hash calc time

Shouldn't you add the additional comparison time that has to be done 
after hash calculation? Hashes do not give 100% guarantee. If there's a 
large number of identical hashes, you'd still need to read all of these 
files to make sure.

Just to explain why I appear to be a lawer: everybody I spoke to about 
this program told me to use hashes, but nobody has been able to explain 
why. I found myself 2 possible reasons:

1) it's easier to program: you don't compare several files in parallel, 
but process one by one. But it's not perfect and you still need to 
compare afterwards. In the worst case, you end up with 3 files with 
identical hashes, of which 2 are identical and 1 is not. In order to 
find this, you'd still have to program the algorithm I use, unless you 
say "oh well, there's a problem with the hash, go and look yourself."

2) it's probably useful if you compare files over a network and you want 
to reduce bandwidth. A hash lets you do that at the cost of local CPU 
and disk usage, which may be OK. That was not my case.

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: Adapting code to multiple platforms

2005-03-12 Thread Patrick Useldinger
Jeffrey Barish wrote:
I have a small program that I would like to run on multiple platforms
(at least linux and windows).  My program calls helper programs that
are different depending on the platform.  I think I figured out a way
to structure my program, but I'm wondering whether my solution is good
Python programming practice.
I use something like this in the setup code:
if os.name == 'posix':
  statfunction = os.lstat
else:
  statfunction = os.stat
and then further in the code:
x = statfunction(filename)
So the idea is to have your "own" function names and assign the 
os-specific functions one and for all in the beginning. Afterwards, your 
code only uses your own function names and, as long as they behave in 
the same way, there's no more if - else stuff.

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
Scott David Daniels wrote:
   comparisons.  Using hashes, three file reads and three comparisons
   of hash values.  Without hashes, six file reads; you must read both
   files to do a file comparison, so three comparisons is six files.
That's provided you compare always 2 files at a time. I compare n files 
at a time, n being the number of files of the same size. That's quicker 
than hashes because I have a fair chance of finding a difference before 
the end of files. Otherwise, it's like hashes without computation and 
without having to have a second go to *really* compare them.

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
François Pinard wrote:
Identical hashes for different files?  The probability of this happening
should be extremely small, or else, your hash function is not a good one.
We're talking about md5, sha1 or similar. They are all known not to be 
100% perfect. I agree it's a rare case, but still, why settle on 
something "about right" when you can have "right"?

I once was over-cautious about relying on hashes only, without actually
comparing files.  A friend convinced me, doing maths, that with a good
hash function, the probability of a false match was much, much smaller
than the probability of my computer returning the wrong answer, despite
thorough comparisons, due to some electronic glitch or cosmic ray.  So,
my cautious attitude was by far, for all practical means, a waste.
It was not my only argument for not using hashed. My algorithm also does 
less reads, for example.

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: Can't seem to insert rows into a MySQL table

2005-03-12 Thread Patrick Useldinger
grumfish wrote:
connection = MySQLdb.connect(host="localhost", user="root", passwd="pw", 
db="japanese")
cursor = connection.cursor()
cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES (%s, %s, 
%s)", ("a", "b", "c") )
connection.close()
Just a guess "in the dark" (I don't use MySQL): is "commit" implicit, or 
do you have to add it yourself?

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
John Machin wrote:
Maybe I was wrong: lawyers are noted for irritating precision. You
meant to say in your own defence: "If there are *any* number (n >= 2)
of identical hashes, you'd still need to *RE*-read and *compare* ...".
Right, that is what I meant.
2. As others have explained, with a decent hash function, the
probability of a false positive is vanishingly small. Further, nobody
in their right mind [1] would contemplate automatically deleting n-1
out of a bunch of n reportedly duplicate files without further
investigation. Duplicate files are usually (in the same directory with
different names or in different-but-related directories with the same
names) and/or (have a plausible explanation for how they were
duplicated) -- the one-in-zillion-chance false-positive should stand
out as implausible.
Still, if you can get it 100% right automatically, why would you bother 
checking manually? Why get back to argments like "impossible", 
"implausible", "can't be" if you can have a simple and correct answer - 
yes or no?

Anyway, fdups does not do anything else than report duplicates. 
Deleting, hardlinking or anything else might be an option depending on 
the context in which you use fdups, but then we'd have to discuss the 
context. I never assumed any context, in order to keep it as universal 
as possible.

Different subject: maximum number of files that can be open at once. I
raised this issue with you because I had painful memories of having to
work around max=20 years ago on MS-DOS and was aware that this magic
number was copied blindly from early Unix. I did tell you that
empirically I could get 509 successful opens on Win 2000 [add 3 for
stdin/out/err to get a plausible number] -- this seems high enough to
me compared to the likely number of files with the same size -- but you
might like to consider a fall-back detection method instead of just
quitting immediately if you ran out of handles.
For the time being, the additional files will be ignored, and a warning 
is issued. fdups does not quit, why are you saying this?

A fallback solution would be to open the file before every _block_ read, 
and close it afterwards. In my mind, it would be a command-line option, 
because it's difficult to determine the number of available file handles 
in a multitasking environment.

Not difficult to implement, but I first wanted to refactor the code so 
that it's a proper class that can be used in other Python programs, as 
you also asked. That is what I have sent you tonight. It's not that I 
don't care about the file handle problem, it's just that I do changes by 
(my own) priority.

You wrote at some stage in this thread that (a) this caused problems on
Windows and (b) you hadn't had any such problems on Linux.
Re (a): what evidence do you have?
I've had the case myself on my girlfriend's XP box. It was certainly 
less than 500 files of the same length.

Re (b): famous last words! How long would it take you to do a test and
announce the margin of safety that you have?
Sorry, I do not understand what you mean by this.
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
John Machin wrote:
Oh yeah, "the computer said so, it must be correct". Even with your
algorithm, I would be investigating cases where files were duplicates
but there was nothing in the names or paths that suggested how that
might have come about.
Of course, but it's good to know that the computer is right, isn't it? 
That leaves the human to take decisions instead of double-checking.

I beg your pardon, I was wrong. Bad memory. It's the case of running
out of the minuscule buffer pool that you allocate by default where it
panics and pulls the sys.exit(1) rip-cord.
Bufferpool is a parameter, and the default values allow for 4096 files 
of the same size. It's more likely to run out of file handles than out 
of bufferspace, don't you think?

The pythonic way is to press ahead optimistically and recover if you
get bad news.
You're right, that's what I thought about afterwards. Current idea is to 
design a second class that opens/closes/reads the files and handles the 
situation independantly of the main class.

I didn't "ask"; I suggested. I would never suggest a
class-for-classes-sake. You had already a singleton class; why
another". What I did suggest was that you provide a callable interface
that returned clusters of duplicates [so that people could do their own
thing instead of having to parse your file output which contains a
mixture of warning & info messages and data].
That is what I have submitted to you. Are you sure that *I* am the 
lawyer here?

Re (a): what evidence do you have?
See ;-)
Interesting. Less on XP than on 2000? Maybe there's a machine-wide
limit, not a per-process limit, like the old DOS max=20. What else was
running at the time?
Nothing I started manually, but the usual bunch of local firewall, virus 
scanner (not doing a complete machine check at that time).

Test:
!for k in range(1000):
!open('foo' + str(k), 'w')
I'll try that.
Announce:
"I can open A files at once on box B running os C. The most files of
the same length that I have seen is D. The ratio A/D is small enough
not to worry."
I wouldn't count on that on a multi-tasking environment, as I said. The 
class I described earlier seems a cleaner approach.

Regards,
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: a program to delete duplicate files

2005-03-13 Thread Patrick Useldinger
John Machin wrote:
Test:
!for k in range(1000):
!open('foo' + str(k), 'w')
I ran that and watched it open 2 million files and going strong ... 
until I figured that files are closed by Python immediately because 
there's no reference to them ;-)

Here's my code:
#!/usr/bin/env python
import os
print 'max number of file handles today is',
n = 0
h = []
try:
while True:
filename = 'mfh' + str(n)
h.append((file(filename,'w'),filename))
n = n + 1
except:
print n
for handle, filename in h:
handle.close()
os.remove(filename)
On Slackware 10.1, this yields 1021.
On WinXPSP2, this yields 509.
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: a program to delete duplicate files

2005-03-14 Thread Patrick Useldinger
David Eppstein wrote:
When I've been talking about hashes, I've been assuming very strong 
cryptographic hashes, good enough that you can trust equal results to 
really be equal without having to verify by a comparison.
I am not an expert in this field. All I know is that MD5 and SHA1 can 
create collisions. Are there stronger algorithms that do not? And, more 
importantly, has it been *proved* that they do not?

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: a program to delete duplicate files

2005-03-14 Thread Patrick Useldinger
David Eppstein wrote:
The hard part is verifying that the files that look like duplicates 
really are duplicates.  To do so, for a group of m files that appear to 
be the same, requires 2(m-1) reads through the whole files if you use a 
comparison based method, or m reads if you use a strong hashing method.  
You can't hope to cut the reads off early when using comparisons, 
because the files won't be different.
If you read them in parallel, it's _at most_ m (m is the worst case 
here), not 2(m-1). In my tests, it has always significantly less than m.

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to create an object instance from a string??

2005-03-19 Thread Patrick Useldinger
Tian wrote:
I have a string:
classname = "Dog"
It's easier without strings:
>>> classname = Dog
>>> classname().bark()
Arf!!!
>>>
--
http://mail.python.org/mailman/listinfo/python-list


[ann] fdups 0.15

2005-03-20 Thread Patrick Useldinger
I am happy to announce version 0.15 of fdups.
Changes in this version:

- ability to limit the number of file handles used
Download
=
To download, go to: http://www.homepages.lu/pu/fdups.html
What is fdups?
==
fdups is a Python program to detect duplicate files on locally mounted 
filesystems. Files are considered equal if their content is identical, 
regardless of their filename. Also, fdups is able to detect and ignore 
symbolic links and hard links, where available.

In contrast to similar programs, fdups does not rely on md5 sums or 
other hash functions to detect potentially identical files. Instead, it 
does a direct blockwise comparison and stops reading as soon as 
possible, thus reducing the file reads to a maximum.

fdups results can either be processed by a unix-type filter, or directly 
 by another python program.

Warning
===
fdups is BETA software. It is known not to produce false positives if 
the filesystem is static.
I am looking for additional beta-testers, as well as for somebody who 
would be able to implement hard-link detection on NTFS file systems.

All feedback is appreciated.
--
http://mail.python.org/mailman/listinfo/python-list


request for book-recommendation

2004-12-10 Thread patrick c.d.
hi,

does here anyone of ya geeks know a book teaching you how to handle gtk,
web-dev with mysql-db-connection and scripting under gnu/linux with phyton?

i'm german (hhaarr) but due to my efficiency-course in english (shool) i
want to learn english by learning phyton ;-)

thx..
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to add a string to the beginning of a large binary file?

2005-03-27 Thread Patrick Useldinger
could ildg wrote:
I want to add a string such as "I love you" to the beginning of a binary file,
How to? and how to delete the string if I want to get the original file?
You shouldn't use Python to write a virus :-)
-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: numbering variables

2005-03-28 Thread Patrick Useldinger
remi wrote:
Hello,
I have got a list like : mylist = ['item 1', 'item 2','item n'] and 
I would like to store the string 'item1' in a variable called s_1, 
'item2' in s_2,...,'item i' in 's_i',... The lenght of mylist is finite ;-)
Any ideas ?
Thanks a lot.
Rémi.
Use a dictionary: variable['s_1']= mylist.pop(), variable['s_2'] = 
mylist.pop() ...
--
http://mail.python.org/mailman/listinfo/python-list


Re: Which is easier? Translating from C++ or from Java...

2005-03-28 Thread Patrick Useldinger
cjl wrote:
Implementations of what I'm trying to accomplish are available (open
source) in C++ and in Java.
Which would be easier for me to use as a reference?
I'm not looking for automated tools, just trying to gather opinions on
which language is easier to understand / rewrite as python.
Depends on what language you know best. But Java is certainly easier to 
read than C++.

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: Which is easier? Translating from C++ or from Java...

2005-03-29 Thread Patrick Useldinger
[EMAIL PROTECTED] wrote:
Patrick Useldinger wrote:
Depends on what language you know best. But Java is certainly easier
to
read than C++.

There's certainly some irony in those last two sentences. However, I
agree with the former. It depends on which you know better, the style
of those who developed each and so forth. Personally, I'd prefer C++.
Not really.
If you know none of the languages perfectly, you are less likely to miss 
something in Java than in C++ (i.e. no &, * and stuff in Java).

However, if you are much more familiar with one of the two, you're less 
likely to miss things there.

-pu
--
http://mail.python.org/mailman/listinfo/python-list


Re: Which is easier? Translating from C++ or from Java...

2005-03-29 Thread Patrick Useldinger
cjl wrote:
I've found a third open source implementation in pascal (delphi), and
was wondering how well that would translate to python?
Being old enough to have programmed in UCSD Pascal on an Apple ][ (with 
a language card, of course), I'd say: go for Pascal!

;-)
--
http://mail.python.org/mailman/listinfo/python-list


http://zephyrfalcon.org/labs/wax.html

2005-04-04 Thread patrick vergain
http://zephyrfalcon.org/labs/wax.html
Wax
:: Email ::
Download area

This page is a stub. Over time, I hope to collect more Wax resources here.
NOTE: Wax currently works (or is supposed to work) with wxPython 2.5.2.7 
or 2.5.2.8. That is the version I am currently using. Newer versions 
might or might not work (try it, though). Older versions might work as 
well, but you'll have to hack the version requirement in core.py.

Download
* Wax on Sourceforge (main page)
* Sourceforge releases
* Sourceforge CVS (may not always be up to date)
* zephyrfalcon.org download area (often has development versions)
* Mailing list (via gmane; archives)
Articles
* The dope on Wax
* Wax primer: A simple editor
* Wax demo: a simple file explorer
* Tao of the Machine Wax archives
Documentation
* Exception hooks
* A minimal application
* Containers
* Pseudo-properties
* The Splitter widget
* Colors
* Button
* ArtProvider
(At some point, there will be one link to bind them all... emoticon:loveit)
Third-party tools and programs using Wax
* ConfigEditor by Mark Andrews
--
http://mail.python.org/mailman/listinfo/python-list


Re: Fast plotting?

2005-04-28 Thread Patrick Ellis
William Park <[EMAIL PROTECTED]> typed:
> Russell E. Owen <[EMAIL PROTECTED]> wrote:
>> Can anyone recommend a fast cross-platform plotting package for 2-D
>> plots?
>>
>> Our situation:
>> We are driving an instrument that outputs data at 20Hz. Control is
>> via an existing Tkinter application (which is being extended for
>> this new instrument) that runs on unix, mac and windows. We wish to
>> update 5-10 summary plots at approximately 2 Hz and will be offering
>> controls to control the instrument and the plots, preferably (but
>> not necessarily) mixed in with the plots.
>
> That's 10-20 plots per second.  The only GUI plotter that I know is
> 'gnuplot', and I don't know if it will spit out anything at 10-20Hz.
> For character plots (like old days terminal), it has speed but ugly to
> look at.
>
>>
>> Ideally the package would create plots in the Tkinter application.
>> But we realize we're unlikely to get the speed we need that way. So
>> we are willing to have the Tkinter app send data to the plotting
>> package  (e.g. via a socket) and have it display the plots in a
>> separate process.
>>
>> We started out with matplotlib, which is a wonderful package (and
>> well integrated with most or all GUI toolkits). Unfortunately it is
>> just too slow -- at least when driving plots integrated with the
>> Tkinter app. (It is getting faster and so are computers, so at some
>> point this will be a great way to go. But for now...)
>>
>> Any suggestions?
>>
>> -- Russell

disipyl is a wrapper around dislin. It includes a class that lets plots
appear inside tkinter frames. I did a quick test and the first demo plot
(run tkdisipyl.py) of a 180 point sine and cosine plotted at over 100 Hz.

http://kim.bio.upenn.edu/~pmagwene/disipyl.html
http://www.mps.mpg.de/dislin/


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fast plotting?

2005-04-29 Thread Patrick Ellis
[EMAIL PROTECTED] <[EMAIL PROTECTED]> typed:
> Are you sure about these numbers?  Most monitors refresh at 70-80Hz,
> so unless you have special display hardware, I'm suspicious of these
> numbers doubt .  I once had a user post to the matplotlib mailing list
> that xplt was refreshing at 1000 Hz.  I think xplt drops plot requests
> while requests are in the queue, so many of the loops in his iteration
> were simply dropped.  If the plotting library puts draw requests in an
> idle event handler, accurate refresh rate numbers can be hard to
> quantify.
>
> JDH

dislin doesn't seem to do that. I varied the number of points in the plot so
the drawing rate went from from 60 Hz to 144 Hz. It scaled linearly above
and below my 85 Hz screen rate. It wouldn't do that if it were dropping
plots. I think that computers are so fast that they can draw to the frame
buffer very quickly, but the slower screen refresh means only some of those
fully drawn frames make it to the monitor.

Even if you are correct, that is still drawing at 85 Hz and thus much faster
than the original poster needed.



-- 
http://mail.python.org/mailman/listinfo/python-list


Pop ups.

2016-03-23 Thread Patrick Rugamba
Hello,
This thing is making me run crazy. Am having these pop ups as I try using 
pycharm saying modify setup, and it is really annoying. I have no clue what is 
causing it but if it can’t be fixed I’d rather uninstall the programs because I 
may end up destroying my pc. I hope you guys can help.
Thanks.

Sent from Mail for Windows 10

-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   5   6   7   >