[issue40052] Incorrect pointer alignment in _PyVectorcall_Function() of cpython/abstract.h

2020-03-24 Thread Andreas Schneider


Andreas Schneider  added the comment:

I forgot, for detecting alignment issues or strict aliasing and this also falls 
under strict aliasing, you need to turn on optimizations.

clang -O2 -Werror -Wcast-align ...

--

___
Python tracker 
<https://bugs.python.org/issue40052>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40052] Incorrect pointer alignment in _PyVectorcall_Function() of cpython/abstract.h

2020-03-24 Thread Andreas Schneider


Andreas Schneider  added the comment:

clang -Werror -Wcast-align ...

rpm -q clang9
clang9-9.0.1-8.1.x86_64

Does that help? Found in CI of

https://gitlab.com/cwrap/pam_wrapper

--

___
Python tracker 
<https://bugs.python.org/issue40052>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40052] Incorrect pointer alignment in _PyVectorcall_Function() of cpython/abstract.h

2020-03-24 Thread Andreas Schneider


Change by Andreas Schneider :


--
type:  -> compile error
versions: +Python 3.8

___
Python tracker 
<https://bugs.python.org/issue40052>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40052] Incorrect pointer alignment in _PyVectorcall_Function() of cpython/abstract.h

2020-03-24 Thread Andreas Schneider


New submission from Andreas Schneider :

In file included from /builds/cryptomilk/pam_wrapper/src/python/pypamtest.c:21:
In file included from /usr/include/python3.8/Python.h:147:
In file included from /usr/include/python3.8/abstract.h:837:
/usr/include/python3.8/cpython/abstract.h:91:11: error: cast from 'char *' to 
'vectorcallfunc *' (aka 'struct _object *(**)(struct _object *, struct _object 
*const *, unsigned long, struct _object *)') increases required alignment from 
1 to 8 [-Werror,-Wcast-align]
ptr = (vectorcallfunc*)(((char *)callable) + offset);
  ^~
1 error generated.


The correct way to do it would be:

union {
   char *data;
   vectorcallfunc *ptr;
} vc;

vc.data = (char *)callable + offset;
return *vc.ptr;

--
components: C API
messages: 364919
nosy: asn
priority: normal
severity: normal
status: open
title: Incorrect pointer alignment in _PyVectorcall_Function() of 
cpython/abstract.h

___
Python tracker 
<https://bugs.python.org/issue40052>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2019-04-30 Thread Andreas Schneider


Andreas Schneider  added the comment:

And how do you deal with METH_VARARGS|METH_KEYWORDS functions which have 3 
arguments?

PyObject* myfunc(PyObject *py_obj, PyObject *args, PyObject *kwargs)

--

___
Python tracker 
<https://bugs.python.org/issue33012>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2019-04-30 Thread Andreas Schneider


Andreas Schneider  added the comment:

Looking at:

https://github.com/python/cpython/commit/359a2f3daba49fde0d3a07fb3c7a8b051c450d08

This is not fixing the underlying issue but hiding it. The right fix would be 
to use a union for ml_meth providing members for the 3 different function. So 
the developer could assign them correctly and the compiler would warn if he 
would do something wrong. Casting to (void *) is just hiding the problem not 
fixing it!

--
nosy: +asn

___
Python tracker 
<https://bugs.python.org/issue33012>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Add header at top with email.message

2018-09-17 Thread Thomas Schneider
Jason Friedman  writes:

> I suppose you already figured out that you can call __delitem__() to
> clear the headers and add them back in whatever order you like.

Well, this would mean saving all headers, deleting all, inserting my
own, and adding the saved original headers again.  Seems complicated.

> I'm interested in learning more about your use case.  Do you have a
> third party with fixed logic that requires the headers in a particular
> order?

Yes, RFC 5321, section 4.4[0] :)

> When an SMTP server receives a message for delivery or further
> processing, it MUST insert trace ("time stamp" or "Received")
> information at the beginning of the message content, as discussed in
> Section 4.1.1.4.

To trace the path a message went, those headers do need to be in a
particular order, or else they won’t make any sense.

[0]: https://tools.ietf.org/html/rfc5321#section-4.4
-- 
https://mail.python.org/mailman/listinfo/python-list


Add header at top with email.message

2018-09-14 Thread Thomas Schneider
Hi,

the EmailMessage class of email.message provides the methods
add_header() and __setitem__() to add a header to a message.
add_header() effectively calls __setitem__(), which does
`self._headers.append(self.policy.header_store_parse(name, val))`.  This
inserts the header at the bottom.

It is, however, sometimes desired to insert a new header at the top of
an (existing) message.  This API doesn’t directly allow this.  In my
opinion, add_header() should have a flag at_top=False or similar, so
that one can get this behaviour (it’ll be a bit difficult with
__setitem__).  What do you think about this?  Is there a feasible way to
do this and change the library?  Should I post it somewhere where the
devs can hear it and suggest that?

Thanks,
--qsx
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue33784] hash collision in instances of ipaddress.ip_network

2018-06-07 Thread Francois Schneider


Francois Schneider  added the comment:

Thanks for the analysis, I agree completely.

Actually the problem was coming from my code where one of the __eq__ method was 
implemented like this:
>>> def __eq__(self, other):
>>>   return hash(self) == hash(other)

so 2 instances with only a slight difference in their ip_network attribute 
(ip_network(u'20.0.2.3/32') and ip_network(u'20.0.2.0/30')) were having the 
same hash and being equal -> they could not be inserted both in the same 
collection.

I will just rewrite my __eq__ method properly.

--
status: pending -> open

___
Python tracker 
<https://bugs.python.org/issue33784>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33784] hash collision in instances of ipaddress.ip_network

2018-06-06 Thread Francois Schneider


New submission from Francois Schneider :

>>> import ipaddress
>>> hash(ipaddress.ip_network(u'20.0.2.3/32')) == 
>>> hash(ipaddress.ip_network(u'20.0.2.0/30'))
True

--
components: Library (Lib)
messages: 318835
nosy: Francois Schneider
priority: normal
severity: normal
status: open
title: hash collision in instances of ipaddress.ip_network
type: behavior
versions: Python 2.7

___
Python tracker 
<https://bugs.python.org/issue33784>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33784] hash collision in instances of ipaddress.ip_network

2018-06-06 Thread Francois Schneider


Change by Francois Schneider :


--
versions: +Python 3.4, Python 3.5

___
Python tracker 
<https://bugs.python.org/issue33784>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: ANN: psutil 5.4.2 released

2017-12-07 Thread André Schneider
Unsubscribe

Giampaolo Rodola'  schrieb am Do., 7. Dez. 2017, 13:16:

> Hello all,
> I'm glad to announce the release of psutil 5.4.2:
> https://github.com/giampaolo/psutil
>
> About
> =
>
> psutil (process and system utilities) is a cross-platform library for
> retrieving information on running processes and system utilization (CPU,
> memory, disks, network) in Python. It is useful mainly for system
> monitoring, profiling and limiting process resources and management of
> running processes. It implements many functionalities offered by command
> line tools such as: ps, top, lsof, netstat, ifconfig, who, df, kill, free,
> nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. It
> currently supports Linux, Windows, OSX, Sun Solaris, FreeBSD, OpenBSD,
> NetBSD and AIX, both 32-bit and 64-bit architectures, with Python versions
> from 2.6 to 3.6. PyPy is also known to work.
>
> What's new
> ==
>
> *2017-12-07*
>
> **Enhancements**
>
> - #1173: introduced PSUTIL_DEBUG environment variable which can be set in
> order
>   to print useful debug messages on stderr (useful in case of nasty
> errors).
> - #1177: added support for sensors_battery() on OSX.  (patch by Arnon
> Yaari)
> - #1183: Process.children() is 2x faster on UNIX and 2.4x faster on Linux.
> - #1188: deprecated method Process.memory_info_ex() now warns by using
>   FutureWarning instead of DeprecationWarning.
>
> **Bug fixes**
>
> - #1152: [Windows] disk_io_counters() may return an empty dict.
> - #1169: [Linux] users() "hostname" returns username instead.  (patch by
>   janderbrain)
> - #1172: [Windows] `make test` does not work.
> - #1179: [Linux] Process.cmdline() is now able to splits cmdline args for
>   misbehaving processes which overwrite /proc/pid/cmdline and use spaces
>   instead of null bytes as args separator.
> - #1181: [OSX] Process.memory_maps() may raise ENOENT.
> - #1187: [OSX] pids() does not return PID 0 on recent OSX versions.
>
> Links
> =
>
> - Home page: https://github.com/giampaolo/psutil
> - Download: https://pypi.python.org/pypi/psutil
> - Documentation: http://psutil.readthedocs.io
> - What's new: https://github.com/giampaolo/psutil/blob/master/HISTORY.rst
>
> --
>
> Giampaolo - http://grodola.blogspot.com
> --
> https://mail.python.org/mailman/listinfo/python-announce-list
>
> Support the Python Software Foundation:
> http://www.python.org/psf/donations/
>
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


[issue20825] containment test for "ip_network in ip_network"

2016-10-20 Thread James Schneider

James Schneider added the comment:

Please consider for implementation in 3.6. I'd love it even more for 3.5 but I 
don't think that will happen. With the latest patch, I don't believe there are 
any backwards-incompatible changes, though.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20825>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20825] containment test for "ip_network in ip_network"

2016-06-01 Thread James Schneider

James Schneider added the comment:

I'd like to ask for a status on getting this merged? 

As a network administrator, these changes would have a magical effect on my 
code dealing with routing tables and ACL's.

--
nosy: +James Schneider

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20825>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: What happens when you 'break' a generator?

2014-07-29 Thread Johannes Schneider

On 29.07.2014 09:18, Frank Millman wrote:

there's not print 'done' statement at the and.



Here I break the loop -

x = test()
for j in x:
 print(j)
 if j == 2:
 break

Now the output is -

start
0
1
2

'done' does not appear, so the generator does not actually terminate. What
happens to it?

My guess is that normal scoping rules apply. Using my example, the generator
is referenced by 'x', so when 'x' goes out of scope, the generator is
garbage collected, even though it never completed.

Is this correct?

Frank Millman






--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Re: The possibility integration in Python without an equation, just an array-like file

2014-05-16 Thread Johannes Schneider
If you do not have a closed form for T(E) you cannot calculate the exact 
value of I(V).


Anyway. Assuming T is integrable you can approximate I(V).

1. Way to do:
interpolate T(E) by a polynomial P and integrate P. For this you need 
the equation (coefficients and exponents) of P. Integrating is easy 
after that.


2. other way:
Use Stair-functions: you can approximate the Value of IV() by the sum 
over T(E_i) * (E_{i+1} - E_i) s.t. E_0 = E_F-\frac{eV}{2} and E_n = 
E_F+\frac{eV}{2}.



3 one more way:
use a computer algebra system like sage.

bg,
Johannes

On 16.05.2014 10:49, Enlong Liu wrote:

Dear All,

I have a question about the integration with Python. The equation is as
below:
and I want to get values of I with respect of V. E_F is known. But for
T(E), I don't have explicit equation, but a .dat file containing
two columns, the first is E, and the second is T(E). It is also in the
attachment for reference. So is it possible to do integration in Python?

Thanks a lot for your help!

Best regards,
​

--
Faculty of Engineering@K.U. Leuven
BIOTECH@TU Dresden
Email:liuenlon...@gmail.com mailto:liuenlon...@gmail.com;
enlong@student.kuleuven.be mailto:enlong@student.kuleuven.be;
enlong@biotech.tu-dresden.de mailto:enlong@biotech.tu-dresden.de
Mobile Phone: +4917666191322
Mailing Address: Zi. 0108R, Budapester Straße 24, 01069, Dresden, Germany






--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Re: The “does Python have variables?” debate

2014-05-08 Thread Johannes Schneider

On 08.05.2014 02:35, Ben Finney wrote:

Marko Rauhamaa ma...@pacujo.net writes:

[..]

Python, on the other hand, has this behaviour::

 foo = [1, 2, 3]
 bar = foo  # ‘bar’ binds to the value ‘[1, 2, 3]’
 assert foo == bar  # succeeds
 foo[1] = spam# ‘foo’ *and* ‘bar’ now == [1, spam, 3]

[..]

IMHO this is the behavior of having a variable pointing to it's value; 
foo to the list and bar to foo.



consider the following:
 def f(l):
... l[1] = 'foo'
...
 l1 =  [1,2,3]
 f(l1)
 l1
[1, 'foo', 3]

this means, l1 consists of pointers to its values.
Otherwise, it's not calling by reference, because

 g(l1)
 l1
[1, 'foo', 3]

does not change l1. Once again, if I pass an object it behaves like 
calling by reference:


 class A:
... a = 0
...
 a = A()
 a.a
0
 def h(a1):
... a1.a = 1
...
 h(a)
 a.a
1

bg,
Johannes


--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Re: why i have the output of [None, None, None]

2014-04-10 Thread Johannes Schneider

because thats the return value of [...]
print retuns None.

On 10.04.2014 15:54, length power wrote:

  x=['','x1','x2','x3','   ']
  x
['', 'x1', 'x2', 'x3', '   ']
  [print(ok) for it in x if it.strip() !=]
ok
ok
ok
[None, None, None]

i understand there are three 'ok' in the output,but why i have the
output of [None, None, None]





--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Re: The sum of numbers in a line from a file

2014-02-21 Thread Johannes Schneider

s = 4
e = 7
with f = file('path_to_file) as fp:
for line in f:
if line.startswith(name):
avg =  sum(map(int, filter(ambda x : len(x)  0,
s.split(' '))[s : e])) / (e -  s)






On 20.02.2014 17:22, kxjakkk wrote:

Let's say I have a sample file like this:

Name1   2 34 5  6 78

name1099-66-7871   A-FY10067815998
name2999-88-7766   A-FN99   100969190
name3000-00-0110AUD5100281976
name4398-72-P/FY7684496978
name5909-37-3689A-FY97941006179

For name1, I want to add together columns 4, 5, 6, and get an average from 
that, then do the same for the last two columns. I want to do this for every 
name.

All I've got is
sum([int(s.strip()) for s in open('file').readlines()])




--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Re: SSH/Telnet program to Router/switch

2014-02-19 Thread Johannes Schneider

On 19.02.2014 09:14, Sujith S wrote:

Hi,

I am new to programming and python. I am looking for a python script to do 
ssh/telnet to a network equipment ? I know tcl/perl does this using expect/send.

Do we have expect available in python as well or need to use some other method ?

Regards
Sujith





I'm using paramiko to access some routers and firewalls from python and 
it works very well.


bg,
Johannes


--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Re: SIngleton from __defaults__

2014-01-24 Thread Johannes Schneider

thnx guys.

On 24.01.2014 01:10, Terry Reedy wrote:

  Johannes Schneider johannes.schnei...@galileo-press.de Wrote in
  message:

On 22.01.2014 20:18, Ned Batchelder wrote:

On 1/22/14 11:37 AM, Asaf Las wrote:
Chris is right here, too: modules are themselves singletons, no matter
how many times you import them, they are only executed once, and the
same module object is provided for each import.


I'm not sure, if this is the whole truth.

think about this example:

cat bla.py
a = 10

cat foo.py
from bla import a


This makes a a global in foo, bound to 10


def stuff():
  return a


This a refers to the global a in foo.


cat bar.py
from foo import stuff
print stuff()
a = 5


This bar.a is irrelevant to the behavior of stuff.


print stuff()

from bla import *
print a

python bar.py
10


foo.a == 10


10


foo.a == 10


10


bla.a == 10


here the a is coming from bla


Twice

and is known in the global namespace.

There is no global namespace outside of modules.


the value differs in stuff()


No it does not.

and before/after the import statement.

foo.a does not change. bar.a is never used.


So the instance of the module differs


Nope. Each of the three module instances is constant. The bindings
within each could change, but there are no rebinding in the code above.




--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Re: SIngleton from __defaults__

2014-01-23 Thread Johannes Schneider

On 22.01.2014 20:18, Ned Batchelder wrote:

On 1/22/14 11:37 AM, Asaf Las wrote:
Chris is right here, too: modules are themselves singletons, no matter
how many times you import them, they are only executed once, and the
same module object is provided for each import.


I'm not sure, if this is the whole truth.

think about this example:

cat bla.py
a = 10

cat foo.py
from bla import a

def stuff():
return a

cat bar.py
from foo import stuff
print stuff()
a = 5
print stuff()

from bla import *
print a

python bar.py
10
10
10

here the a is coming from bla and is known in the global namespace. But 
the value differs in stuff() and before/after the import statement. So 
the instance of the module differs - it cannot be a singelton.


bg,
Johannes

--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Imports in Python

2014-01-21 Thread Johannes Schneider

Hi List,
I remember some document explaining the python imports in detail 
somewhere, but I don't have any idea where it was. Even no idea if it 
was in the List or some blogbost.


Does anybody of you have some suggestions where I can find those 
informations besides the official documentation?


bg,
Johannes

--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Re: matlabFunction Equivalent?

2014-01-21 Thread Johannes Schneider

On 20.01.2014 23:09, rpi.bal...@gmail.com wrote:

Hey all,

I'm new at Python, so if you see any mistakes feel free to let me know.

I'm trying to take a symbolic expression and turn it into a variable equation 
or function. I think that just an expression of variables would be preferable.

I have a range equation which I form using symbols and then take various 
derivatives of it. I then want to have these derivatives on hand to use for 
various functions, but short of using sub every time or just copy pasting from 
the console output (I don't want to do that), I can't find an efficient way to 
do this. Matlab had matlabFunction which was really handy, but I don't think 
Python has an equivalent.


import numpy as np
import scipy as sp
import sympy as sy
import math as ma

x, y, z, x_s, y_s, z_s, theta, theta_dot, x_dot, y_dot, z_dot = sy.symbols('x y 
z x_s y_s z_s theta theta_dot x_dot y_dot z_dot')

rho = (x**2 + y**2 + z**2 + x_s**2 + y_s**2 + z_s**2 - 2*(x*x_s + 
y*y_s)*sy.cos(theta) + 2*(x*y_s - y*x_s)*sy.sin(theta) - 2*z*z_s)**(0.5)

rho_dot = (x*x_dot + y*y_dot + z*z_dot - (x_dot*x_s + y_dot*y_s)*sy.cos(theta) 
+ theta_dot*(x*x_s + y*y_s)*sy.sin(theta) + (x_dot*y_s - 
y_dot*x_s)*sy.sin(theta) + theta_dot*(x*y_s - y*x_s)*sy.cos(theta) - 
z_dot*z_s)/rho

drho_dx = sy.diff(rho, x)

drho_dy = sy.diff(rho, y)

drho_dz = sy.diff(rho, z)

#I then want drho_dx, etc to be variable expressions with x, y, z, etc as 
variables instead of symbols or numbers. I could do:

x, y, z = 1200, 1300, 1400 #m

drho_dx = subs([x, x], [y, y], [z, z])

#but this seems inefficient to do multiple times. Thoughts?



If you  don not mind installing other programs, maybe you can have a 
look at sage (www.sagemath.org). That's a ComputerAlgebraSystem using 
python as its base and supporting most (all?) of the python syntax and 
moduls


bg,
Johannes



--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Brython (Python in the browser)

2013-12-27 Thread Johannes Schneider

On 27.12.2013 07:14, Pierre Quentel wrote:

Hi,

Ever wanted to use Python instead of Javascript for web client programming ? 
Take a look at Brython, an implementation of Python 3 in the browser, with an 
interface with DOM elements and events

Its use is very simple :
- load the Javascript library brython.js : script src=/path/to/brython.js
- embed Python code inside a tag script type=text/python
- run the Python script on page load : body onload=brython()

The Python code is translated into Javascript and executed on the fly

Brython supports the DOM API, HTML5, SVG, with some syntaxic sugar to make the 
interface more concise (a la jQuery) ; interaction with Javascript libraries is 
very straightforward. The Brython site provides documentation and many examples

After 1 year of intense development, Brython now covers most of the Python3 
syntax and can run most of the modules of the Python3.3 standard distribution 
unmodified, including complex packages like unittest. The team aims at covering 
100% of all of Python that makes sense in a browser environment

Home page : http://www.brython.info
Development site : https://bitbucket.org/olemis/brython/src
Downloads : https://bitbucket.org/olemis/brython/downloads
Community : https://groups.google.com/forum/?fromgroups=#!forum/brython



that's amazing.
is there any python construct which is not usable with brython? OR, the 
oder way around, anything possible in JS, which does not work in brython?


bg,
Johannes



--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Differences between obj.attribute and getattr(obj, attribute)

2013-12-11 Thread Johannes Schneider

Hi list,
can somebody explain me the difference between accessing attributes via
obj.attribute and getattr(obj, attribute)?

Is there a special reason or advantage when using getattr?

bg,
Johannes

--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

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


Re: Differences between obj.attribute and getattr(obj, attribute)

2013-12-11 Thread Johannes Schneider

thank you guys.
On 11.12.2013 10:36, Chris Angelico wrote:

2013/12/11 Johannes Schneider johannes.schnei...@galileo-press.de:

can somebody explain me the difference between accessing attributes via
obj.attribute and getattr(obj, attribute)?

Is there a special reason or advantage when using getattr?

You use getattr when the attribute name comes from a string, rather
than a literal. There's no advantage to it when you know ahead of time
what attribute you're looking for. It's useful when you iterate over
dir(), for instance:

print(You can call...)
n=0
for attr in dir(x):
 if callable(getattr(x,attr)):
 print(x.%s()%attr)
 n+=1
print(...,n, options.)

ChrisA



--
Johannes Schneider
Webentwicklung
johannes.schnei...@galileo-press.de
Tel.: +49.228.42150.xxx

Galileo Press GmbH
Rheinwerkallee 4 - 53227 Bonn - Germany
Tel.: +49.228.42.150.0 (Zentrale) .77 (Fax)
http://www.galileo-press.de/

Geschäftsführer: Tomas Wehren, Ralf Kaulisch, Rainer Kaltenecker
HRB 8363 Amtsgericht Bonn

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


Re: Debugging decorator

2013-10-28 Thread Schneider


On 10/26/2013 01:55 AM, Yaşar Arabacı wrote:

Hi people,

I wrote this decorator: https://gist.github.com/yasar11732/7163528

When this code executes:

 @debugging
 def myfunc(a, b, c, d = 48):
 a = 129
 return a + b

 print myfunc(12,15,17)

This is printed:

 function myfunc called
 a 12
 c 17
 b 15
 d 48
 assigned new value to a: 129
 returning 144
144

I think I can be used instead of inserting and deleting print
statements when trying to see what is
passed to a function and what is assingned to what etc. I think it can
be helpful during debugging.

It works by rewriting ast of the function and inserting print nodes in it.

What do you think?




Looks very nice, but I've three  questions:

1. What happens, if a function has more then one decorator? Wouldn't it 
be better to

just remove the debugging decorator instead of removing all decorators?

2. In the case of an assignment (but holds for the return statement too).
think about the following code:

a = 0
@debugging
def foo():
a = a +  1

def bar():
#assign something else to a

Imagine foo() and bar() being called in two different threads. Wouldn't 
it be better


to replace  a = a + 1 by

|global_debugging_lock_objekt.acquire()|
a = a + 1
print assigned new value to a, %r, a
|global_debugging_lock_objekt.release()|

for some global lock object.

3. What happens in the case of  a += 1?

bg,
Johannes

--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390

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


Good Python Book

2013-10-09 Thread Schneider

Hi List,

I'm looking for a good advanced python book. Most books I looked at up 
to now are on beginners level.
I don't need a reference (that's online) or a book explaining how to use 
the interpreter or how to use list comprehensions on the one side and 
skipping topics like decorators, metaclasses on the other side.


any suggestions?

bg,
Johannes

--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390

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


Re: What minimum should a person know before saying I know Python

2013-09-26 Thread Schneider

I would say it's a little bit more:
You have to know the keywords and (basic) concepts, e.g. you really have 
to understand what it means, that everything is a class.
If you get foreign, you have to be able to understand it. And the other 
way round, given a problem, you should be able to write a working solution.


bg
Johannes

On 09/20/2013 06:23 PM, Mark Janssen wrote:

I started Python 4 months ago. Largely self-study with use of Python 
documentation, stackoverflow and google. I was thinking what is the minimum 
that I must know before I can say that I know Python?

Interesting.  I would say that you must know the keywords, how to make
a Class, how to write a loop.  That covers about 85% of it.



--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390

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


Python performance

2013-08-02 Thread Schneider

Hi list,

I have to write a small SMTP-Relay script (+ some statistic infos) and 
I'm wondering, if this
can be done in python (in terms of performance, of course not in terms 
of possibility ;) ).


It has to handle around 2000 mails per hour for at least 8hours a day 
(which does not mean, that it is allowed not to respond the rest of the day.


Can this be done? or should I better use some other programming language?
My second choice would be erlang.

bg,
Johannes


--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsber
ger Strasse 260
48157 Münster
0251/5205 390

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


Re: Python performance

2013-08-02 Thread Schneider

On Fri 02 Aug 2013 02:59:26 PM CEST, Tim Chase wrote:

On 2013-08-02 14:00, Schneider wrote:

I have to write a small SMTP-Relay script (+ some statistic infos)
and I'm wondering, if this
can be done in python (in terms of performance, of course not in
terms of possibility ;) ).

It has to handle around 2000 mails per hour for at least 8hours a
day (which does not mean, that it is allowed not to respond the
r

est of the day.


Can this be done? or should I better use some other programming
language? My second choice would be erlang.


I suspect it depends on a lot of factors:

- will your network connection support that much traffic?  (And an
   ISP that will grant you permission to spew that volume of email?)


yes, because we are the ISP.


- are these simple text emails, or are they large with lots of
   attachments, inline images, PDFs, or whatever?


any kind of mail. No restrictions allowed.


- are the statistics that you're gathering simple, or do they require
   complex analysis of the documents passing through?


very simple statistics, mostly counting and time statistics.


- is the load 8hr straight of spewing email, or is it bursty?  If
   it's bursty, you can internally queue them up when load gets high,
   delivering them from that queue when load diminishes.  Given the
   store-and-forward nature of email, there's no guarantee that if
   you spewe

d them at ~33/minute (that/s a little faster than one

   every two seconds), they'd arrive at their destination any faster
   than if you'd queued them up and sent them at a more steady rate.


I guess it's bursty. I don't have finer granulated information about 
their time distribution.



-tkc



Queuing the mails for a while is not possible, because the tool should 
sit between the client and smtp-server.

It should act as proxy, not as server.

bg,
Johannes



--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python performance

2013-08-02 Thread Schneider

On 08/02/2013 03:09 PM, Ray Cote wrote:

- Original Message -

From: Schneider j...@globe.de
To: python-list@python.org
Sent: Friday, August 2, 2013 8:00:09 AM
Subject: Python performance

Hi list,

I have to write a small SMTP-Relay script (+ some statistic infos)
and
I'm wondering, if this
can be done in python (in terms of performance, of course not in
terms
of possi

bility ;) ).


It has to handle around 2000 mails per hour for at least 8hours a day
(which does not mean, that it is allowed not to respond the rest of
the day.


A quick calculation shows that 2,000 mails per hour is less than 1 email every 
second.
Plenty of time to handle individual emails.


This is just true, if the mails arrive equally distributed. We cannot 
ensure this.

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


PyPy 2.1 released

2013-08-01 Thread David Schneider

PyPy 2.1 - Considered ARMful


We're pleased to announce PyPy 2.1, which targets version 2.7.3 of the Python
language. This is the first release with official support for ARM processors in 
the JIT.
This release also contains several bugfixes and performance improvements. 

You can download the PyPy 2.1 release here:

http://pypy.org/download.html

We would like to thank the Raspberry Pi Foundation http://www.raspberrypi.org 
for supporting the work
to finish PyPy's ARM support.


The first beta of PyPy3 2.1, targeting version 3 of the Python language, was
just released, more details can be found here: 
http://morepypy.blogspot.com/2013/07/pypy3-21-beta-1.html


What is PyPy?
=

PyPy is a very compliant Python interpreter, almost a drop-in replacement for
CPython 2.7. It's fast (http://speed.pypy.org)
due to its integrated tracing JIT compiler.

This release supports x86 machines running Linux 32/64, Mac OS X 64 or Windows
32. This release also supports ARM machines running Linux 32bit - anything with
ARMv6 (like the Raspberry Pi) or ARMv7 (like the Beagleboard,
Chromebook, Cubieboard, etc.) that supports VFPv3 should work. Both
hard-float armhf/gnueabihf and soft-float armel/gnueabi builds are
provided. armhf builds for Raspbian are created using the Raspberry Pi
`custom cross-compilation toolchain https://github.com/raspberrypi`_
based on gcc-arm-linux-gnueabihf and should work on ARMv6 and
ARMv7 devices running Debian or Raspbian. armel builds are built
using the gcc-arm-linux-gnuebi toolchain provided by Ubuntu and
currently target ARMv7.

Windows 64 work is still stalling, we would welcome a volunteer
to handle that.


Highlights
==

* JIT support for ARM, architecture versions 6 and 7, hard- and soft-float ABI

* Stacklet support for ARM

* Support for os.statvfs and os.fstatvfs on unix systems

* Improved logging performance

* Faster sets for objects

* Interpreter improvements

* During packaging, compile the CFFI based TK extension

* Pickling of numpy arrays and dtypes 

* Subarrays for numpy

* Bugfixes to numpy

* Bugfixes to cffi and ctypes

* Bugfixes to the x86 stacklet support

* Fixed issue 1533: fix an RPython-level OverflowError for 
space.float_w(w_big_long_number). https://bugs.pypy.org/issue1533

* Fixed issue 1552: GreenletExit should inherit from BaseException. 
https://bugs.pypy.org/issue1552

* Fixed issue 1537: numpypy __array_interface__ https://bugs.pypy.org/issue1537
  
* Fixed issue 1238: Writing to an SSL socket in PyPy sometimes failed with a 
bad write retry message. https://bugs.pypy.org/issue1238

Cheers,

David Schneider for the PyPy team.
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Re: Lambda function Turing completeness

2013-07-31 Thread Schneider

On Wed 31 Jul 2013 08:53:26 AM CEST, Musical Notation wrote:

Is it possible to write a Turing-complete lambda function (which does not 
depend on named functions) in Python?


what should a sinlge Turing-complete lambda function be?
For me, a programming language can be Turing-complete or a function can 
be universal,  e.g. like an interpreter for a  programming language.


bg,
Johannes

--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390
--
http://mail.python.org/mailman/listinfo/python-list


Re: Critic my module

2013-07-29 Thread Schneider

Hi,

lets uses the ls example:
the way you do it now implies, that you search your PATH variable until 
it finds a
program called 'ls'. So if we are able to change the PATH variable, and 
put out own
'ls' somewhere in the (new) paths, calling you ls() will execute 
whatever we want our

own  ls' to do.

Second remark: if the behavior of some tools is changed (for examples 
with using aliases)
we cannot expect the called tool (in the example: 'ls') to give the same 
output on

every system.

this can be avoided (mostly) by ensuring that the right program (in the 
example /bin/ls) is called, and not only ls.


bg,
Johannes

On 07/26/2013 12:39 PM, Devyn Collier Johnson wrote:


On 07/25/2013 09:58 AM, Schneider wrote:

Hi,

nice idea.

mybe -  for security reasons - you should ensure, that the right tool 
is called and not some tool put the path with the same name.


bg,
Johannes

Devyn Collier Johnson devyncjohn...@gmail.comOn Thu 25 Jul 2013 
03:24:30 PM CEST, Devyn Collier Johnson wrote:

Aloha Python Users!

   I made a Python3 module that allows users to use certain Linux
shell commands from Python3 more easily than using os.system(),
subprocess.Popen(), or subprocess.getoutput(). This module (once
placed with the other modules) can be used like this

import boash; boash.ls()

   I attached the module. I plan to release it on the Internet soon,
but feel free to use it now. It is licensed under LGPLv3.

   The name comes from combining Boa with SHell. Notice that the
module's name almost looks like BASH, a common Linux shell. The Boa
is a constrictor snake. This module makes Unix shells easier to use
via Python3. This brings the system shell closer to the Python shell.


Mahalo,

Devyn Collier Johnson
devyncjohn...@gmail.com






--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390


What do you mean by that Schneider?

Mahalo,

Devyn Collier Johnson
devyncjohn...@gmail.com



--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390

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


Re: Critic my module

2013-07-25 Thread Schneider

Hi,

nice idea.

mybe -  for security reasons - you should ensure, that the right tool is 
called and not some tool put the path with the same name.


bg,
Johannes

On Thu 25 Jul 2013 03:24:30 PM CEST, Devyn Collier Johnson wrote:

Aloha Python Users!

   I made a Python3 module that allows users to use certain Linux
shell commands from Python3 more easily than using os.system(),
subprocess.Popen(), or subprocess.getoutput(). This module (once
placed with the other modules) can be used like this

import boash; boash.ls()

   I attached the module. I plan to release it on the Internet soon,
but feel free to use it now. It is licensed under LGPLv3.

   The name comes from combining Boa with SHell. Notice that the
module's name almost looks like BASH, a common Linux shell. The Boa
is a constrictor snake. This module makes Unix shells easier to use
via Python3. This brings the system shell closer to the Python shell.


Mahalo,

Devyn Collier Johnson
devyncjohn...@gmail.com






--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390
--
http://mail.python.org/mailman/listinfo/python-list


[issue18117] Missing symlink:Current after Mac OS X 3.3.2 package installation

2013-06-03 Thread Gavan Schneider

Gavan Schneider added the comment:

A lot of this is past my level but speaking from my level I just want packages 
to be consistent, i.e., if there is a symlink it should point to something 
(preferably useful) not dangle as is the case now.

Also I want an installed version to look the same no matter what version it 
might be. Specifically the version number should only occur once in the file 
tree. This then allows me to specify ***at the system level*** what I want when 
invoking (via a Current or similar link) my postgres and other build scripts, 
specifically so they don't need to be hand crafted just so they build against 
new new and latest install.

If I ever get to the stage where I am building to a specific version that's not 
the global selection I can do that by taking proper steps (but that's not what 
I usually want to do after installing a new version).

Continuing in the vein of one only mention of the version number in the package 
tree: why is there a python3.3 folder inside 
.../Pyton.framework/Versions/3.3/lib? Won't lib/Python3.4 stuff get put in its 
own Version?

As for the reluctance to rename the package for 3.4. Wont it be Python3 and the 
rename could just as logically be done for the current release:
  /Library/Frameworks/
Python.framework/... # all the Pyton 2 stuff
Python3.famework
  Versions
3.3/...
3.4/...
Current - 3.4
...

Finally there seems to be a convention with all the other installed packages 
for a Current symlink (note especially Tcl/Tk) to do something useful within 
their respective Versions folder. Is it too much to suggest that Python just 
follow this convention (albeit with the package name changed to pyton3 to 
prevent potential conflicts)?

Anyway, please excuse my drifting so far from a simple report of a broken 
and/or missing installer link :)

Regards
Gavan Schneider

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18117
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18117] Missing symlink:Currnet after Mac OS X 3.3.2 package installation

2013-06-02 Thread Gavan Schneider

New submission from Gavan Schneider:

There is a missing symlink.

Context:
Installed package:
http://www.python.org/ftp/python/3.3.2/python-3.3.2-macosx10.6.dmg
with no apparent problems onto a 'clean' system, i.e., no other python packages 
other than OS X 10.8.3 defaults.

Found the following in /Library/Frameworks/Python.framework:
pendari:Python.framework postgres$ ls -las
total 24
0 drwxr-xr-x  3 root  wheel  204 14 May 06:49 .
0 drwxr-xr-x  8 root  wheel  374  2 Jun 17:06 ..
8 lrwxr-xr-x  1 root  wheel   24  2 Jun 17:06 Headers - 
Versions/Current/Headers
8 lrwxr-xr-x  1 root  wheel   23  2 Jun 17:06 Python - Versions/Current/Python
8 lrwxr-xr-x  1 root  wheel   26  2 Jun 17:06 Resources - 
Versions/Current/Resources
0 drwxr-xr-x  3 root  wheel  102 14 May 06:54 Versions

However:
pendari:Versions postgres$ ls -las
total 0
0 drwxr-xr-x  3 root  wheel  102 14 May 06:54 .
0 drwxr-xr-x  3 root  wheel  204 14 May 06:49 ..
0 drwxrwxr-x  7 root  admin  306 14 May 06:54 3.3

Specifically we are missing the following from .../Versions:
8 lrwxr-xr-x  1 root  wheel3  2 Jun 17:27 Current - 3.3

to make all the other symlinks work as intended.

This also implies the ~/.bash_profile patch would be improved if the existing:
PATH=/Library/Frameworks/Python.framework/Versions/3.3/bin:${PATH}
was replaced by:
PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}

Apologies if this has already been reported. It is my first report so I could 
easily have missed something: I searched with terms installer mac.

Regards
Gavan Schneider

--
assignee: ronaldoussoren
components: Installation, Macintosh
messages: 190474
nosy: gavan, ronaldoussoren
priority: normal
severity: normal
status: open
title: Missing symlink:Currnet after Mac OS X 3.3.2 package installation
type: behavior
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18117
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18117] Missing symlink:Current after Mac OS X 3.3.2 package installation

2013-06-02 Thread Gavan Schneider

Changes by Gavan Schneider pythonbug-...@snkmail.com:


--
title: Missing symlink:Currnet after Mac OS X 3.3.2 package installation - 
Missing symlink:Current after Mac OS X 3.3.2 package installation

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18117
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18117] Missing symlink:Current after Mac OS X 3.3.2 package installation

2013-06-02 Thread Gavan Schneider

Gavan Schneider added the comment:

Appreciate the comment about potential problems with mixed installations of 
python3 and python2. And note that along these lines there is no attempt by the 
installer to symlink python - python3 (which could have nasty side effects if 
the full path was not specified in system applications).

However there is still a problem: the installer is creating three dead 
symlinks, which is not correct.

Agree putting Python3 into its own /Library/Frameworks/Python3.framework would 
be a better way to go.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18117
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: serialize a class to XML and back

2013-05-31 Thread Schneider

On 26.05.2013 22:48, Roy Smith wrote:

In article mailman.2197.1369600623.3114.python-l...@python.org,
  Chris Rebert c...@rebertia.com wrote:


On May 23, 2013 3:42 AM, Schneider j...@globe.de wrote:

Hi list,

how can I serialize a python class to XML? Plus a way to get the class

back from the XML?

There's pyxser: http://pythonhosted.org/pyxser/


My aim is to store instances of this class in a database.

Honestly, I would avoid XML if you can. Consider using JSON (Python
includes the `json` module in the std lib) or pickle instead. Compared to
XML: The former is more standardized (in the context of serializing
objects) and less verbose; the latter is more efficient (if you don't care
about cross-language accessibility); both have more convenient APIs.

Some other points...

If you care about efficiency and want to use json, don't use the one
that comes packaged with the standard library.  There are lots of
third-party json packages (ujson is the one we use) which are
significantly faster.  Not sure if that's true of the newest python
releases, but it was certainly true in 2.6.


I think performance can be a problem in future. This question is part of 
a multi-user rss-reader solution, which I'm going to develop.


I want to store the feed entries (+ some additional data) as XML in a 
database.



The advantage of pickle over json is that pickle can serialize many
types of objects that json can't.  The other side of the coin is that
pickle is python-specific, so if you think you'll ever need to read your
data from other languages, pickle is right out.



--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390

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


Re: serialize a class to XML and back

2013-05-31 Thread Schneider

On 25.05.2013 07:54, dieter wrote:

Schneider j...@globe.de writes:


how can I serialize a python class to XML? Plus a way to get the class
back from the XML?

My aim is to store instances of this class in a database.

In case you want to describe the XML data via an XML-schema
(e.g. to exchange it with other applications; maybe via
WebServices), you may have a look at PyXB.


The approach of PyXB may be a bit different from yours:

   It starts with an XML-schema description and from
   it generates Python classes corresponding to the types
   mentioned in the schema.

   Instances of those classes can then be easily serialized
   to XML and XML documents corresponding to types defined
   in the schema can easily be converted into corresponding
   class instances.

   It is not too difficult to customize the classes
   used for a given type - e.g. to give them special methods
   related to your application.


You may want to start with your (arbitrary) Python classes
and get their instances serialized into an adequate XML document.

This will not work in all cases: some things are very difficult
to serialize (maybe even not serializable at all - e.g. locks).


I have just small classes containing text (strings)  numbers (as ids) 
and references to other classes of this type.




If you plan to use anything already existing, then almost
surely, this will impose restrictions of your classes.




--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390

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


serialize a class to XML and back

2013-05-23 Thread Schneider

Hi list,

how can I serialize a python class to XML? Plus a way to get the class 
back from the XML?


My aim is to store instances of this class in a database.

bg,
Johannes

--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390

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


Re: Python for philosophers

2013-05-16 Thread Schneider
Maybe the implementation of the Python Interpreter could be seen as 
transition function.
This can be understand in detail, but it even if you know how the 
interpreter works, you don't really know to work

_with_ the interpreter.
Even more, there are a lot of decisions, which are made 'by design' and 
don't have a clear answer. to see why somethings are
done in the way they are done you have to understand the philosophy of 
programming with python.


bg,
Johannes

On 13.05.2013 02:34, Gregory Ewing wrote:

Citizen Kant wrote:
What I do here is to try to understand. That's different from just 
knowing. Knowledge growth must be consequence of understanding's 
increasing. As the scope of my understanding increases, the more I 
look for increasing my knowledge. Never vice versa, because, knowing 
isn't like to be right, it's just knowing.


It doesn't always work that way. With some facts plus a
theory, you can deduce more facts. But it's always possible
for there to be more facts that you can't deduce from what
you already know.

But take in account that with shortening I refer to according to 
Python's axiomatic parameters.


I think what you're trying to say is that it takes an
expression and reduces it to a canonical form, such as
a single number or single string.

That's true as far as it goes, but it barely scratches
the surface of what the Python interpreter is capable
of doing.

In the most general terms, the Python interpeter (or
any other computer system, for that matter) can be thought
of as something with an internal state, and a transition
function that takes the state together with some input
and produces another state together with some output:

   F(S1, I) -- (S2, O)

(Computer scientists call this a finite state machine,
because there is a limited number of possible internal
states -- the computer only has so much RAM, disk space,
etc.)

This seems to be what you're trying to get at with your
game-of-chess analogy.

What distinguishes one computer system from another is
the transition function. The transition function of the
Python interpreter is rather complicated, and it's
unlikely that you would be able to figure out all its
details just by poking in inputs and observing the
outputs. If you really want to understand it, you're
going to have to learn some facts, I'm sorry to say. :-)




--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390

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


Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider

 The close method is defined and flushing and closing a file, so
 
 it should not return until that's done.
 
 
 
 What command are you using to create the temp file?
 
 

re command to write the file: 
f=open(fn,'w')
... then create HTML text in a string
f.write(html)
f.close 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider
 I would consider the chance that the disk may be faulty, or the file 
 
 system is corrupt. Does the problem go away if you write to a different 
 
 file system or a different disk?
 

It's a relatively new MacBook Pro with a solid state disk.  I've not noticed 
any other disk problems. I did a repair permissions (for what it's worth). 
Maybe I'll have it tested at the Genius Bar.  I don't have the full system on 
another computer to try that; but will work on that today.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider

 
  Or that the filesystem may be full? Of course, that's usually obvious
 
  more widely when it happens...
 
  
 
  Question: is the size of the incomplete file a round number? (Like
 
  a multiple of a decent sized power of 2)
 
 
 
 Also on what OS X file system type does the file being created reside, 
 
 in particular, is it a network file system?
 

File system not full (2/3 of disk is free)

Source (correct one) is 47,970 bytes. Target after copy of 45,056 bytes.  I've 
tried changing what gets written to change the file size. It is usually this 
sort of difference.

The file system is Mac OS Extended Journaled (default as out of the box).  
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider

 The file system is Mac OS Extended Journaled (default as out of the box).

I ran a repair disk .. .while it found and fixed what it called minor 
problems, it did something.  However, the repair did not fix the problem. I 
just ran the program again and the source is 47,970 bytes and target after copy 
if 45,056.

Interestingly, the test I run just after the copy , i run a file compare:

code:

 if showproperties: 
print Filecompare :,filecmp.cmp(fn,loc+fname)
print Statinfo:+fn+:\n, os.stat(fn)
print Statinfo:+loc+fname+:\n, os.stat(loc+fname)

results:

Filecompare : True
Statinfo:/var/folders/p_/n5lktj2n0r938_46jyqb52g4gn/T/speakers.htm:
posix.stat_result(st_mode=33188, st_ino=32205850, st_dev=16777218L, st_nlink=1, 
st_uid=501, st_gid=20, st_size=45056, st_atime=1365749178, st_mtime=1365749178, 
st_ctime=1365749178)
Statinfo:/Users/rmschne/Documents/ScottishOilClub/SOC Board Doc Sharing 
Folder/Meetings/speakers.htm:
posix.stat_result(st_mode=33188, st_ino=32144179, st_dev=16777218L, st_nlink=1, 
st_uid=501, st_gid=20, st_size=45056, st_atime=1365749178, st_mtime=1365749178, 
st_ctime=1365749178)

It shows file size 45,056 on both source and target, which is the file size of 
the flawed target, and is not what Finder shows for source.

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


Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider
On Friday, 12 April 2013 09:26:21 UTC+1, Cameron Simpson  wrote:
 
 |   Question: is the size of the incomplete file a round number? (Like
 
 |   a multiple of a decent sized power of 2)
 
 [...]
 
 | Source (correct one) is 47,970 bytes. Target after copy of 45,056
 
 | bytes.  I've tried changing what gets written to change the file
 
 | size. It is usually this sort of difference.
 
 
 
 45046 is exactly 11 * 4096. I'd say your I/O is using 4KB blocks,
 
 and the last partial block (to make it up to 47970) didn't get
 
 written (at the OS level).
 
 
 
 Earlier you wrote:
 
 | I have created a file in temp space, then use the function
 
 | shutil.copyfile(fn,loc+fname) from fn to loc+fname.
 
 and:
 
 | Yes, there is a close function call  before the copy is launched. No other 
 writes.
 
 | Does Python wait for file close command to complete before proceeding?
 
 
 
 Please show us the exact code used to make the temp file.
 
 
 
 I would guess the temp file has not been closed (or flushed) before
 
 the call to copyfile.
 
 
 
 If you're copying data to a tempfile, it will only have complete
 
 buffers (i.e. multiples of 4096 bytes) in it until the final flush
 
 or close.
 
 
 
 So I'm imagining something like:
 
 
 
   tfp = open(tempfilename, w)
 
   ... lots of tfp.write() ...
 
   shutil.copyfile(tempfilename, newfilename)
 
 
 
 Note above no flush or close of tfp. So the final incomplete I/O
 
 buffer is still in Python's memory; it hasn't been actually written
 
 to the temp file because the buffer has not been filled, and the file
 
 has not been closed.
 
 
 
 Anyway, can you show us the relevant bits of code involved?
 
 
 
 Cheers,
 
 -- 
 
 Cameron Simpson c...@zip.com.au
 
 
 
 Processes are like potatoes.- NCR device driver manual

Thanks for the observation. 

Code (simplified but results in same flaw) (which a close, far as I can tell).

def CreateSpeakerList1():
import shutil
import filecmp
import os.path 

t=get_template('speaker_list.html')
fn=TEMP_DIR+SOC_SPEAKER_LIST
fn=tempfile.gettempdir()+/+SOC_SPEAKER_LIST
f=open(fn,'w')
speaker_list=Speaker.objects.order_by('status__order','targetmtg__date')
print Creating  + SOC_SPEAKER_LIST +   ...
html=(smart_str(t.render(Context(
{
'css_include_file':CSS_INCLUDE_FILE,
'css_link':False,
'title': ORG_NAME+ Speaker List,
'speaker_list': speaker_list,
}
f.write(html)
f.close
print Wrote +fn
shutil.copyfile(fn,SOC_GENERAL_OUTPUT_FOLDER+SOC_SPEAKER_LIST)
print Filecompare 
:,filecmp.cmp(fn,SOC_GENERAL_OUTPUT_FOLDER+SOC_SPEAKER_LIST)
print Statinfo:+fn+:\n, os.stat(fn)
print Statinfo:+SOC_GENERAL_OUTPUT_FOLDER+SOC_SPEAKER_LIST+\n, 
os.stat(SOC_GENERAL_OUTPUT_FOLDER+SOC_SPEAKER_LIST)
return

Output on latest run:

Creating speakers.htm ...
Wrote /var/folders/p_/n5lktj2n0r938_46jyqb52g4gn/T/speakers.htm
Filecompare : True
Statinfo:/var/folders/p_/n5lktj2n0r938_46jyqb52g4gn/T/speakers.htm:
posix.stat_result(st_mode=33188, st_ino=32332374, st_dev=16777218L, st_nlink=1, 
st_uid=501, st_gid=20, st_size=45056, st_atime=1365758139, st_mtime=1365758139, 
st_ctime=1365758139)
Statinfo:/Users/rmschne/Documents/ScottishOilClub/Output/speakers.htm
posix.stat_result(st_mode=33188, st_ino=32143886, st_dev=16777218L, st_nlink=1, 
st_uid=501, st_gid=20, st_size=45056, st_atime=1365758029, st_mtime=1365758139, 
st_ctime=1365758139)


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


Re: shutil.copyfile is incomplete (truncated)

2013-04-12 Thread Rob Schneider
On Friday, 12 April 2013 10:22:21 UTC+1, Chris Angelico  wrote:
 On Fri, Apr 12, 2013 at 7:18 PM, Rob Schneider rmsc...@gmail.com wrote:
 
f.close
 
 
 
 Yep, there's the problem! See my previous post for details. Change this to:
 
 
 
 f.close()
 
 
 
 and you should be sorted.
 
 
 
 ChrisA

Slapping forehead ... hard.  Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: USBLock : lock/unlock your computer with a USB key

2013-04-12 Thread Schneider

On 11.04.2013 22:16, Ian Kelly wrote:

On Thu, Apr 11, 2013 at 9:23 AM, Ethan Furman et...@stoneleaf.us wrote:

On 04/11/2013 04:13 AM, Sven wrote:

Yes, I had the idea to add bluetooth too, removes the whole plugging and
unplugging spiel. I might start work on that,
and if anyone else wants to dive in and help, feel free. I will probably
need to refactor the Listener a little, or
create a USB and BT listener class.


Doesn't BlueTooth have a 30 foot range?  For locking I'd rather be at 10 or
even 5 feet away.

Pair it with a Google Glass and have it lock after you've stopped
looking at the screen for 30 seconds.


Maybe not with Google Glass, but with a web cam placed on top of the 
screen. Like Samsung does since the Galaxy S III.
There it just happens the other way round: no lock as long as you have 
your face in front of the phone.


bg,
Johannes

--
GLOBE Development GmbH
Königsberger Strasse 260
48157 MünsterGLOBE Development GmbH
Königsberger Strasse 260
48157 Münster
0251/5205 390

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


shutil.copyfile is incomplete (truncated)

2013-04-11 Thread Rob Schneider
Using Python 2.7.2 on OSX, I have created a file in temp space, then use the 
function shutil.copyfile(fn,loc+fname) from fn to loc+fname.

At the destination location, the file is truncated. About 10% of the file is 
lost.  Original file is unchanged.

I added calls to statinfo immediately after the copy, and all looks ok 
(correct file size).

filecmp.cmp(fn,loc+fname)
print Statinfo:+fn+:\n, os.stat(fn)
print Statinfo:+loc+fname+:\n, os.stat(loc+fname)

But when I look at the file in Finder, destination is smaller and even looking 
at the file (with text editor) file is truncated.

What could be causing this?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: shutil.copyfile is incomplete (truncated)

2013-04-11 Thread Rob Schneider
Thanks. Yes, there is a close function call  before the copy is launched. No 
other writes.
Does Python wait for file close command to complete before proceeding?
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue17580] ctypes: ARM hardfloat argument corruption calling functions with many float arguments

2013-03-30 Thread David Schneider

New submission from David Schneider:

This issue affects C functions with many float/double arguments called through 
ctypes on ARM using the hardfloat ABI (i.e. the standard distribution for the 
raspberry pi uses hard-float).

Calling a C function using ctypes on ARM hard-float that takes a large number 
of float arguments (more than 16 floats or more than 8 doubles) corrupts the 
first float/double arguments passed on the stack to the called function. 

To check the issue run the following commands on an ARM hard-float system:
make
python bug.py

A patch for this issue has been accepted into libffi.

--
components: ctypes
files: ctypes_arm.tar
messages: 185557
nosy: bivab
priority: normal
severity: normal
status: open
title: ctypes: ARM hardfloat argument corruption calling functions with many 
float arguments
type: behavior
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file29613/ctypes_arm.tar

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Creating an object that can track when its attributes are modified

2013-03-07 Thread Schneider

Hi,
maybe you could do this by a decorator on the setattr method. It should 
look more or less

like your implementation, but in my eyes it's a cleaner and can be reused.

Further, I would use a stack for each attribute, so that you can restore 
all previous values.


bg,
Johannes

On 03/06/2013 05:07 PM, Ben Sizer wrote:

I am trying to make an object that can track when its attributes have been 
assigned new values, and which can rollback to previous values where necessary. 
I have the following code which I believe works, but would like to know if 
there are simpler ways to achieve this goal, or if there are any bugs I haven't 
seen yet.


class ChangeTrackingObject(object):
 def __init__(self):
 self.clean()

 def clean(self):
 Mark all attributes as unmodified.
 object.__setattr__(self, '_dirty_attributes', dict())

 def dirty_vals(self):
 Returns all dirty values.
 return dict( [ (k,v) for k,v in self.__dict__.iteritems() if k in 
self._dirty_attributes]  )

 def get_changes_and_clean(self):
 Helper that collects all the changes and returns them, cleaning the dirty flags at 
the same time.
 changes = self.dirty_vals()
 self.clean()
 return changes

 def rollback(self):
 Reset attributes to their previous values.
 for k,v in self._dirty_attributes.iteritems():
 object.__setattr__(self, k, v)
 self.clean()

 def __setattr__(self, key, value):
 # If the first modification to this attribute, store the old value
 if key not in self._dirty_attributes:
 if key in self.__dict__:
 self._dirty_attributes[key] = object.__getattribute__(self, 
key)
 else:
 self._dirty_attributes[key] = None
 # Set the new value
 object.__setattr__(self, key, value)


I am aware that adding a new attribute and then calling rollback() leaves the 
new attribute in place with a None value - maybe I can use a special DeleteMe 
marker object in the _dirty_attributes dict along with a loop that calls 
delattr on any attribute that has that value after a rollback.

I also believe that this won't catch modification to existing attributes as 
opposed to assignments: eg. if one of the attributes is a list and I append to 
it, this system won't notice. Is that something I can rectify easily?

Any other comments or suggestions?

Thanks,


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


Re: SSH Connection with Python

2012-10-29 Thread Schneider

thank you guys for the huge list of answers,
In my setting I have to access some routers and firewall from a 
linux-client.


I think I'll try Fabric.


On 26.10.2012 06:20, Rodrick Brown wrote:

On Oct 25, 2012, at 6:34 AM, Schneider j...@globe.de wrote:


Hi Folkz,
how can i create a SSH-Connection with python? I have to send some commands to 
the remote host and parse their answers.
greatz Johannes

Fabric is the way to go!


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


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


SSH Connection with Python

2012-10-25 Thread Schneider

Hi Folkz,
how can i create a SSH-Connection with python? I have to send some 
commands to the remote host and parse their answers.

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


[issue15362] pyport.h includes antiquated UTF handling for FreeBSD

2012-07-15 Thread John Schneider

New submission from John Schneider j...@jschneider.com:

Revision 36793 introduced a libc wrapper for FreeBSD 5.x which addressed some 
UTF issues. Unfortunately, this causes C compilation errors for certain ports.

Also reference issues 10910, 1455641

This change is no longer applicable for FreeBSD 9.  I'm not sure what version 
of FreeBSD made it not longer applicable, but there were reports of it still 
being necessary for FreebSD 7. FreeBSD 6 - 8 should be tested with this test 
script:

#!/usr/bin/env python

from ctypes import *

cdll.LoadLibrary(libc.so.7)
libc = CDLL(libc.so.7)

assert libc.isspace(0xa0) == 0


I've also attached a patch for python 2.7.3.

--
components: Unicode, ctypes
files: patch-pyport.h
messages: 165550
nosy: JohnSchneider, ezio.melotti
priority: normal
severity: normal
status: open
title: pyport.h includes antiquated UTF handling for FreeBSD
versions: Python 2.7
Added file: http://bugs.python.org/file26388/patch-pyport.h

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15362
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12572] HP/UX compiler workarounds

2011-07-18 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

Martin - I don't have time to manage your project's administrative requirements 
with respect to my fixes.  I'm providing them out of the hope they will be of 
use to others who need to build on HP/UX, but I don't really care if they make 
it into the main branch or not.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12561] Compiler workaround for wide string constants in Modules/getpath.c (patch)

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

I am attaching an updated patch.  This version specifically checks for __hpux, 
and the macro name has been changed to avoid clashing with other uses.

--
Added file: http://bugs.python.org/file22663/getpath.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12561
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12572] HP/UX compiler workarounds

2011-07-15 Thread Jim Schneider

New submission from Jim Schneider jim.schnei...@dataflux.com:

The C compiler that comes with HP/UX 11 has some shortcomings that prevent 
building Python 3.2.1 out of the box.  I am attaching patches here as I work 
through issues.

The first patch fixes namespace shortcomings when trying to use struct termios.

--
components: Build
files: termios.patch
keywords: patch
messages: 140423
nosy: jschneid
priority: normal
severity: normal
status: open
title: HP/UX compiler workarounds
type: compile error
versions: Python 3.2
Added file: http://bugs.python.org/file22664/termios.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12561] Compiler workaround for wide string constants in Modules/getpath.c (patch)

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

I am collecting HP/UX compiler bug workarounds in issue 12572.

Stinner - is the patch you mentioned in a released version of Python 3.2?  
Also, how is it affected by the fact that the (wide char) strings in question 
are constants?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12561
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5999] compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but has not been defined as a type

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

I am collecting HP/UX compiler workarounds in issue 12572.  I will be adding 
patches to it as I produce them, including a patch to fix this on HP/UX.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5999
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12572] HP/UX compiler workarounds

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

This patch works around the problem underlying issue 5999 by making sure the 
__STDC_VERSION__ macro is defined and has a value of at least 199901

--
Added file: http://bugs.python.org/file22666/fileutils.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12572] HP/UX compiler workarounds

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

Workaround for compiler bug; HP/UX compiler refuses to past (implicitly char *) 
string constants with wide (wchar_t *) string constants.  This patch is also 
pasted to issue 12561 (which should be closed).

Note:  There is disagreement as to the best way to proceed on this issue.  
Stinner (aka haypo) has a patch that should work with non ASCII character sets, 
and my patch will almost certainly not work in those cases.  YMMV.

--
Added file: http://bugs.python.org/file22668/getpath.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12572] HP/UX compiler workarounds

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

This patch just reduces compiler noise by explicitly casting pointers to void 
*.  I expect the Visual Studio C/C++ compiler suite also issued these warnings, 
too.

--
Added file: http://bugs.python.org/file22669/typeobject.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12572] HP/UX compiler workarounds

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

Sorry - last comment should have been compiler refuses to past*e*, not past.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12572] HP/UX compiler workarounds

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

The HP/UX C compiler grumbles when a symbol that is declared static is later 
defined without the static storage class specifier.  The attached patch just 
adds the missing static keywords.

--
Added file: http://bugs.python.org/file22670/Python-ast.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12572] HP/UX compiler workarounds

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

I'm adding the original listeners for issue 5999 to this one.

The fileutils.patch patch attached to this issue directly addresses what's 
wrong in issue 5999; I'd consider it closed, but as I didn't open it, and I'm 
not actually part of the python project, that's not my call to make.

--
nosy: +eric.araujo, loewis, srid, terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12572] HP/UX compiler workarounds

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

From issue 12561 (which I will be closing):

Author: STINNER Victor (haypo) *  Date: 2011-07-15 15:36  
Use L CONSTANT to decode a byte string to a character string doesn't work 
with non-ASCII strings. _Py_char2wchar() should be used instead: see for 
example this fix, commit 5b6e13b6b473. 

This is in reference to getpath.patch.  I have no need to support 
internationalized versions of the constant strings my patch addresses, so 
Stinner's commit is overkill for me.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12561] Compiler workaround for wide string constants in Modules/getpath.c (patch)

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

Constant initializers are required to be constants, not function calls, so 
_Py_char2wchar cannot be used in the definition of lib_python (line #138 of 
Modules/getpath.c).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12561
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12572] HP/UX compiler workarounds

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

Update to getpath.patch (issue 12561) - this version uses _Py_char2wchar where 
possible.  Unfortunately, as lib_python is declared and defined statically, 
this can't be used in both cases where the HP/UX compiler has issues.

--
Added file: http://bugs.python.org/file22671/getpath.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12572] HP/UX compiler workarounds

2011-07-15 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

Terry - I apologize for jumping the gun a bit, and let me be a bit more clear.  
When I realized that the HP/UX compiler was going to have as many problems as 
it does compiling python 3, I decided it would be best to create a single issue 
for all of the compiler issues.  In retrospect, opening an issue for the single 
compiler bug discussed in issue 12561 was a mistake, and I had hoped to migrate 
the discussion of that issue here.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12572
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5999] compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but has not been defined as a type

2011-07-14 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

Martin - sys/_mbstate_t.h provides a definition for mbstate_t only (at least 
on HP/UX 11i V2.0).  I can verify that the problem still exists for Python 
3.2.1.  I am working on a workaround for this issue, and I will attach a patch 
once I get it to build.

--
nosy: +jschneid

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5999
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12561] Compiler workaround for wide string constants in Modules/getpath.c (patch)

2011-07-14 Thread Jim Schneider

New submission from Jim Schneider jim.schnei...@dataflux.com:

In Modules/getpath.c, the following line (#138) causes problems with some 
compilers (HP/UX 11, in particular - there could be others):

static wchar_t *lib_python = Llib/python VERSION;

Similarly, line #644:

module_search_path = L PYTHONPATH;

The default HP/UX compiler fails to compile this file with the error Cannot 
concatenate character string literal and wide string literal.  The attached 
patch converts these two string literals to wide string literals that the HP/UX 
compiler can understand.

Very limited testing indicates that the patch is benign (it does not affect the 
build on Linux running on x86_64).

--
components: Build
files: getpath.patch
keywords: patch
messages: 140348
nosy: jschneid
priority: normal
severity: normal
status: open
title: Compiler workaround for wide string constants in Modules/getpath.c 
(patch)
type: compile error
versions: Python 3.2
Added file: http://bugs.python.org/file22655/getpath.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12561
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5999] compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but has not been defined as a type

2011-07-14 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

I got it to build on HP-UX 11.  However, there are a lot of compiler warnings 
about type mismatches, the _ctypes, _multiprocessing and termios modules failed 
to build, and make test died after not finding a usable binascii module.

To get it to build, I did the following:
1)  Applied the patch I attached to issue 12561
2)  Created a directory sys, and copied /usr/include/sys/stdsyms.h into it.
3)  Did chmod 644 on sys/stdsyms.h and applied the patch stdsyms.patch that 
I've attached to this issue to it.
4)  Ran configure with the argument CPPFLAGS=-I.

At this point, make ran to completion, and produced a python binary.  However, 
make test dies within seconds of starting up.

--
keywords: +patch
Added file: http://bugs.python.org/file22656/stdsyms.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5999
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5999] compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but has not been defined as a type

2011-07-14 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

Martin - sys/_mbstate.h is only included if _INCLUDE__STDC_A1_SOURCE is 
defined.  The only way this gets defined in the vendor-provided include files 
is if _XOPEN_SOURCE is defined and is equal to 500, or __STDC_VERSION__ is 
defined and is greater than or equal to 199901.

I've attached a patch to broaden the _XOPEN_SOURCE case (as the test should 
clearly have been =, not ==).  Defining __STDC_VERSION__ to 199901 or greater 
will also do the job, but it feels more like a hack than just fixing what's 
broken in the vendor include files.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5999
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12561] Compiler workaround for wide string constants in Modules/getpath.c (patch)

2011-07-14 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

The __W macro is needed because the token-pasting operator binds to the macro's 
argument immediately;  Having WCHAR(y) expand to __W(y) means that __W is 
passed WCHAR's argument after it's been macro-expanded.  Without the 
intermediate step, WCHAR(VERSION) becomes LVERSION.

As for the name - I have no objection to reasonable name changes.  I picked 
WCHAR because it converts its argument to a wchar_t *.

Finally - I am aware that the HP/UX C compiler is broken.  Unfortunately, I am 
required to work with it, and can neither replace it nor ignore it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12561
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5999] compile error on HP-UX 11.22 ia64 - 'mbstate_t' is used as a type, but has not been defined as a type

2011-07-14 Thread Jim Schneider

Jim Schneider jim.schnei...@dataflux.com added the comment:

Yes, it is a patch to an HP-provided C compiler system header file.  I cannot 
provide the actual file it patches, due to copyright limitations.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5999
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Displaying SVG in tkinter using cairo and rsvg

2011-02-16 Thread Arndt Roger Schneider

Martin P. Hellwig schrieb:

Hi all,

Information on using tkinter for displaying an svg image seems a bit low 
spread on the Internet. I recently played around with pygame and svg and 
realized, hold on this can be done with tk too. So I thought I post a 
little example for future generations :-) (and also have stored at 
http://dcuktec.googlecode.com/hg/source/examples/cairo_rsvg_tkinter.py).


So here it is if you are interested:

[snip]

raster images from SVG:
There are multiple methods to convert a scalable vector graphic
into a bitmap.
In addition to cairo, librsvg and rsvg imageMagick contains a
vector graphic format similar to svg--gradients and transparency
are problematic for this approach, but its a while since I had
looked into it...

My product Jeszra imports svg into Tk(using tkpath
http://jeszra.sourceforge.net/jeszra/Jeszra_TechnicalNotes.html#d0e10279
), preserving it as a vector graphics.
There are, of course, limitations to what can be preserved in Tk:

http://jeszra.sourceforge.net/jeszra/SVG_Import.html

The other way is much simpler to convert a Tk graphics into
svg, which is also implemented in Jeszra.
All svg graphics on http://jeszra.sourceforge.net and 
http://gestaltitems.sourceforge.net are generated by Jeszra from

Tk (there are some hundred graphics)...

The generator API is open and a draft documentation is online at:
http://jeszra.sourceforge.net/api/ch01s04.html
http://jeszra.sourceforge.net/api/index.html

Jeszra API Concerning svg:
http://jeszra.sourceforge.net/api/ch04.html
http://jeszra.sourceforge.net/api/ch05.html
http://jeszra.sourceforge.net/api/ch06.html
http://jeszra.sourceforge.net/api/ch07.html
http://jeszra.sourceforge.net/api/ch08.html

Here is an overview about Jeszra, SVG and Tk:
http://jeszra.sourceforge.net/api/pictures/overview.svg


The svg on those page gets on-demand converted into flash,
for the internet explorer.

Is there anyting else You want to know about svg?

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


Re: Displaying SVG in tkinter using cairo and rsvg

2011-02-16 Thread Arndt Roger Schneider

Martin P. Hellwig schrieb:

On 02/16/11 09:04, Arndt Roger Schneider wrote:


[snip]

tkpath does not seem to come standard with Python's tk version when I 
looked into it a couple of years ago, but maybe it has now?



tk canvas and tkpath share the same interface, the first tkpath was
a plugin into the tk canvas. A tkinter wrapper class will
be a simple subclass of tk canvas introducing the new item types:
path, ppolygone, polyline, circle, elipsis, pimage, prect, ptext, group 
and for tkpath 0.3 three

additional messages for: style, gradient and distance, that's all
~50 lines of code.


Is there anyting else You want to know about svg?



No not really :-), I just wanted to display a SVG in tkinter with the 
minimal amount of external dependencies, since I have achieved that I 
thought I share my experience, so that the next time someone google 
tkinter and display svg it will return something that (well at least of 
the time of this writing) worked.




Well CAIRO is sort of a shifting target...
--currently I am stuck with PPC and new CAIRO versions cannot longer
being built on it anymore :-(--

CAIRO can be real pain on non-X11-linux platforms. ImageMagick
is simpler than CAIRO cross-platform wise.

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


Re: Problem with giant font sizes in tkinter

2011-02-11 Thread Arndt Roger Schneider

Steven D'Aprano schrieb:

On Thu, 10 Feb 2011 15:48:47 +, Cousin Stanley wrote:



Steven D'Aprano wrote:



I have a tkinter application under Python 2.6 which is shows text in a
giant font, about twenty(?) times larger than expected.

The fonts are set using:

titlefont = '-Adobe-Helvetica-Bold-R-Normal-*-180-*' 
buttonfont = '-Adobe-Helvetica-Bold-R-Normal-*-140-*' 
labelfont = '-Adobe-Helvetica-Bold-R-Normal-*-140-*' 



 Although I've been a linux user for several years, that type of font
 spec hurts my head  :-)

 Will the more simplistic type of tuple spec not work in your tkinter
 application ?



I don't know, but I'll give it a try.

Nevertheless, I'd like to learn how to diagnose these sorts of font 
issues. Can anyone suggest where I should start?






Those adobe helveticas are bitmap fonts.
Tk 8.5 uses freetype to render fonts under X11,
if you wish to use outdated bitmap fonts under X11,
then disable-xft when building Tk 8.5.

I do assume there are different tk versions on your
various platforms, and the troubling one is with
version 8.5 --8.5 uses anti-aliasing hence freetype.

Recommendation: Get rid of bitmap fonts under X11.

BTW the default fonts under Linux are:
bitstream vera sans (for helvetica)
bitstream vera (for times)
and bitstream vera sans mono (for courier).

In my opion those bitstream fonts are much better
than the mentioned Adobe fonts.

-roger




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


Re: [Code Challenge] WxPython versus Tkinter.

2011-01-23 Thread Arndt Roger Schneider

rantingrick schrieb:

[snip]

1. You cannot define the terms--restrict your opponent--
   and battle it yourselves.
2. Your specified directory browser is useless.
   --At least define that the directory browser must have
 constant complexity to work with volatile
 data over a network...

-roger

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


Re: Screen readers for Tkinter (was Re: Tkinter: The good, the bad, and the ugly!

2011-01-21 Thread Arndt Roger Schneider

Littlefield, Tyler schrieb:
 And of course, it should also offer support for Windows, since most of 
the computer users use Windows, especially those who need accessibility 
features.

uh. no, and no.
Plenty of those utilizing screen readers are using macs nowadays, as 
well as vinux or some derivitave there of.



Do you have first hand experience with it under AQUA?
I think Tk-aqua (also 8.6) should work out-of-the-box
with brail-lines, text-to-speech and such;
the older carbon built however wont...

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


Re: Tkinter: The good, the bad, and the ugly!

2011-01-18 Thread Arndt Roger Schneider

Terry Reedy schrieb:

On 1/16/2011 11:20 PM, rantingrick wrote:


Ok, try this...

 http://juicereceiver.sourceforge.net/screenshots/index.php
 http://www.sensi.org/~ak/pyslsk/pyslsk6.png
 http://www.wxwidgets.org/about/screensh.htm



Ok, wxwidgets can look at least as good as tk. Agreed that wxpython 
might instead link to the excellent wxwidgets page.




Well, tosssing screenshots around doesn't prove wether
a framwork/toolkit is good or not;
It only displays the developers commitment to create
a work of art.

Lets examine one of your examples:
http://juicereceiver.sourceforge.net/screenshots/index.php#mac

Overall impression:
The software was designed for windows; more or less
following the windows hci-guidelines,
The windows version is resonable good.

About the Aqua screenshots:

 1. Negative actions are located on the falling diagonale.
2-3. The select background and foreground inside the multi-column 
listbox have the wrong color--the used color originates from text fields.

 4. The multi-column listbox should have vertical gridlines.
5-6. Too much top and bottom padding inside the column header.
 7. The column texture is wrong --there is a visible line in the bottom.
 8. There are white boxess around the input fields.
 9. Header column label and lisstbox content are not aligned.
10. There is separator line between the status bar and the
brusshed dialog.
11. Last picture: there is a single page inside the tabet
control.
12. Last picture: The text Select radio ... is trucated,
the dialog isn't large enough.
13. The Scheduler activation should come before
customizing the scheduler.
14. The dialog uses sunken group boxes for some sections,
these group should be 2% darker than their surrounding
container.
15. The spacing rules from the aqua hci guidlines are
violated. The inner tabset should have 20px distance from
both sides, 20px from the bottom, 14px from top.
16. Second last picture: The button lables are truncated.
17. Tree: Uses the wrong folder symbols--from windows--,
select background and foreground are wrong, too.

- The Aqua hci-guidlines discourage group boxes,
  the same with the windows guidlines, too. Get rid
  off group boxes.

- second last picture: There should be more top
  padding for the checkbutton inside the white rectangle;
  best the same as left-padding.

- There no focus frames visilbe inside these screenshots,
  it would be interessting to see how those are realised.

- The icon buttons should be brushed, likewise shoud the
  column header have brushed background.

- Aqua hci guidelines: All dialogs should
  have a centered appearance.

Back to rantingrick 21st century toolkit/framwork:
Let's have a look at the numbers:
Worlwide pc market are 300 Million pcs per year,
this number includes desktops(2/3) and servers(1/3).
Your gui app is not relevant on servers.
Quite a good deal of the remaining pc's are sold in
countries with rampant ilict software copies;
Since there are no software cost for these copies
the people tend to install the big, bloated software
pieces from named computer companies
--you wont sell linux there, because it is more
  expensive than an ilict windows+office++.

~ 100 Million potential new desktop users for you.

Apple's projection for the ipad in 2011 are 65 Million pieces,
iphone and ipod touch will be roughly the same.
130 Million ios pieces.


~ 130 Million new ios users for you.


The android market is still unclear, but I do suppose
it will rival ios, lets say 100 Million in 2011.

~ 100 Million new android users for you.


Microsoft mobile and blueberry are wildcards;
no serious forecast is possible for these devices.
Lets assume:

~ 50 Million blueberry, windows mobile.

Total is: 380 Million potential new user for your application.


wxWidgets: 3600 LOC, python: 140 LOC
--these are very old numbers, but from the same time period.

wxWidgets on desktop, present for windows, Aqua and X11.
wxWidgets on ios, possible but unlikely, the thing is way to big
for any ios device.
wxWidgets on android not realistic.
wxWidgets on blueberry not possible.
wxWidgets on windows mobile; development is
silverlight with .net, so wxWidgets would have to be
ported to .net; not realistic.

python on desktop, present.
python on ios, possible --if not yet present.
python on android, present.
python on blueberry, possible.
python on windows mobile, present--but .net support deprecated by ms.

The smartphone and table market has only started, yet.
In 2011 the mobile market is already larger than the desktop pc,
almost 3 times largerv.

The desktop pc market is in decline; there is
however a shift toward pc-servers, instead.
It is anybodies guess how far the pc-desktop decline will go.
Every 21st century toolkit or framework must run on
mobile platforms!

wxWidgets was written ~1992, it is a copy of
mfc, which in turn is a copy of MacApp. MacApp
is also OSS, maintained through an industrie consortium.
Why do you 

Re: Tkinter: The good, the bad, and the ugly!

2011-01-18 Thread Arndt Roger Schneider

Octavian Rasnita schrieb:

From: Arndt Roger Schneider arndt.ro...@addcom.de



At least keep the disclaimer:
 Well, tosssing screenshots around doesn't prove wether
 a framwork/toolkit is good or not;
 It only displays the developers commitment to create
 a work of art.



Overall impression:
The software was designed for windows; more or less
following the windows hci-guidelines,
The windows version is resonable good.




This is the most important thing, because most users use Windows. Those 
who have other preferences are not forced to choose Windows, so it's 
their choice, and if the interface doesn't look so nice, that's it.




See disclaimer.
Since you mentioned nice: I do not use such words
to charcterize a gui. I think the developers of said software
tried hard to make it nice and beauty, hence  the brushed
background and group-boxes --BTW: the windows Guidelines also
discourage using group-boxes for usability reasons (see Theo. Mandel
object oriented user interfaces).



Back to rantingrick 21st century toolkit/framwork:
Let's have a look at the numbers:
Worlwide pc market are 300 Million pcs per year,
this number includes desktops(2/3) and servers(1/3).
Your gui app is not relevant on servers.
Quite a good deal of the remaining pc's are sold in
countries with rampant ilict software copies;
Since there are no software cost for these copies



Python is an open source software and the programmers that use Python 
might also prefer to offer open source software for free so this is not 
important. And not legal is not a very correct term, because somebody 
from Iran or North Corea must respect the laws from his/her country and 
in her/his country some things might not be forbidden by law, so it may 
be perfectly legal.




Nice cropping,
the people tend to install the big, bloated software
pieces from named computer companies
--you wont sell linux there, because it is more
  expensive than an ilict windows+office++.

Illict as in unlicensed. Law has nothing to do with it.
And yes these unlicensed sofware has an negative
impact on the distribution of free open source software.

I wonder, what license do you use in your own work,
and what do you think about people which violate your license?



~ 100 Million potential new desktop users for you.

Apple's projection for the ipad in 2011 are 65 Million pieces,
iphone and ipod touch will be roughly the same.
130 Million ios pieces.
The android market is still unclear, but I do suppose
it will rival ios, lets say 100 Million in 2011.

~ 100 Million new android users for you.


Microsoft mobile and blueberry are wildcards;
no serious forecast is possible for these devices.
Lets assume:

~ 50 Million blueberry, windows mobile.

Total is: 380 Million potential new user for your application.


wxWidgets: 3600 LOC, python: 140 LOC
--these are very old numbers, but from the same time period.



This is a bad comparison because the programs targetted to the mobile 
phones are in most cases very different than the programs that need to 
be used on the desktop.


This is the marketplace for all gui applications,
and not a comparision.

Do you want to say that WxPython is not good just because it doesn't 
work well on mobile phones?


I do not comment on the quality of either wxWidgets
nor wxPython. Both exist for certain reasons.
The desktop pc was the sole target for all the
big C++ gui class liraries in 1992. Over time a large code
base evolved which makes it very difficult to get these class
libraries into new
markets--such as today with mobile devices.

Those numbers show that only the mobile phones are important, because 
there are more mobile phones than computers.




No, it doesn't. There are billions of mobile phones with
graphical user interfaces, still these phones weren't
relevant for gui applications.

Well, Python needs a better GUI lib for using them on desktop computers, 
not on mobile phones.




wxWidgets is suiteable for the desktop.


The desktop pc market is in decline; there is
however a shift toward pc-servers, instead.



What do you mean by declining? Are there fewer desktop PCs today than a 
year ago?


I am writing about graphical applications not computers.




Looking into wxWidgets:
Interactivity: keyboard focus, shortcuts, function keys,
  active foreground, active background are obsolete.
  hovering tooltips obsolete, status bar to large, obsolete.
  scrolled dialogs, obsolete. OK, Cancel, Retry, Abort
  buttons, obsolete, file dialogs obsolete, old style printing
  obsolete, drag-and-drop obsolete...



Who says that they are obsolete?
A good GUI interface should offer keyboard accessibility. Otherwise it 
is broken.


OK, I take keyboard focus back.




Summary wxWidgets:
wxWidgets is large scale C++ library from the 20th century,
solemnly dedicated toward desktop computers.




Yes, Python should promote a good GUI lib for desktop computers, and not 
a poor GUI lib for desktop computers that might also work on other

Re: Tkinter: The good, the bad, and the ugly!

2011-01-18 Thread Arndt Roger Schneider

rantingrick schrieb:

On Jan 18, 7:09 am, Arndt Roger Schneider arndt.ro...@addcom.de
wrote:



Summary wxWidgets:
wxWidgets is large scale C++ library from the 20th century,
solemnly dedicated toward desktop computers.
wxWidgets originates from a time before templates
were used in C++ and thus duplicates many of
today's C++ features.
wxWidgets is not suitable for a modern type
GUI ad thus clearly not the toolkit/framework
of the 21st century.




Alight i'll except that Rodger. Wx may be unusable for the mobile
market. And since the mobile market is exploding --and will continue
to explode-- then we need to consider this. However, does any GUI
library exist that can handle desktop, mobile, and accessibility and
do it all in a 21st century way? You slaughtered wx but failed to
provide any alternative, however i am listing to your advice contently
because it is very good advice. Read on...


Thanks! Again this is not about the quality of wxWidgets,
wxWidgets grew large because there was vested interest in it.
Its success is its undoing.



We DO need to consider the mobile market in this decision. Maybe it is
time for us to actually get on the cutting edge of GUI's. Maybe we
should head an effort to create a REAL 21st century GUI that can
handle desktop, mobile, and accessibility, and do it all whilst
looking very sharp! Sure we rob from peter to pay paul. We will use
Tkinters awesome API and geometry managers, wxPythons feature
richness, and any other code we can steal to make this work!


I am not sure whether this sarcasms or for real...,
so I'll take for genuine.

Tk is also doomed, and Tkinter isn't Tk.
You are right about keeping the separate geometry
managers, though.

For starters:
http://kenai.com/projects/swank

Swank publishes java/swing classes as tk
in jtcl, which is similar to what tkinter does for
python and tk.

It should be feasible to use swank with the
tkinter interface for jpython--without jtcl.
However, this doesn't make tkinter mobile,
neither is swing available on android.
When you look into the android developer
documents concerning the gui, then you can see
that the gui model is quite similar to tk.
So I suppose android can be reached by jpython
in a two stage process.

The other devices are more difficult to reach, though.
There is webkit on some, but not all. Webkit
is available for the desktop, ios and android--today without svg.

There are two ways to gain graphical independence:
First a basic implementation for each platform and
second through abstraction.

With abstraction I mean to base the gui on a common graphical
model present on all platforms and hence to implement the
toolkit on-top of it in python (not C, C++, java,javascript), python!
The single common graphical model is SVG.



Then we can advertise python as the best GUI language available. I
have nothing against seeing Python on more devices and this would no
doubt bring that dream into fruition. There is a huge hole in the
market at this very moment and we need to pounce on it like a hungry
tiger on wildebeest. Just think how wonderful it would be to switch
from mobile to desktop and still write beatiful Python code.



So be it.
-roger
--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter: The good, the bad, and the ugly!

2011-01-18 Thread Arndt Roger Schneider

rantingrick schrieb:

On Jan 18, 12:25 pm, Arndt Roger Schneider arndt.ro...@addcom.de
wrote:


rantingrick schrieb:


On Jan 18, 7:09 am, Arndt Roger Schneider arndt.ro...@addcom.de




We DO need to consider the mobile market in this decision. Maybe it is
time for us to actually get on the cutting edge of GUI's. Maybe we
should head an effort to create a REAL 21st century GUI that can
handle desktop, mobile, and accessibility, and do it all whilst
looking very sharp! Sure we rob from peter to pay paul. We will use
Tkinters awesome API and geometry managers, wxPythons feature
richness, and any other code we can steal to make this work!


I am not sure whether this sarcasms or for real...,
so I'll take for genuine.




No this is real, albeit a bit fantastical. Thats probably why you
thought it was sarcasm :).

However, we need to start a revolution in the GUI world. Currently we
(as developers) are slaves to the OEM's and OS's. This must change. We
must unify GUI coding the same way OpenGL unified graphics coding.
Multiplicity is ruining any and all advancements in Graphical User
Interfaces. Sure multiplicity is great in emerging systems (language,
culture, GUI, etc, etc) However at some point  you must reign in this
multiplicity and harness the collective knowledge into an all
encompassing standard. OpenGUI is that standard.  It should be shipped
with every OS in the world. This is the only way we can have mobile,
desktop, and accessibility all combined into one beautiful package.
Then the contest come down to who can create the best abstraction API.



There has been no advancement in GUI-Design. Today it looks and
behaves just the way Bill Atkinson designed it.
Technical revolutions are made by disruptive thoughts,
which are never collective.
...The problem with gui-design:It requires an graphical artist,
a well versed writer, a software architect and a programmer.
The first two job description are the important ones.

...No OS-vender is going to allow that, it equals
lost control.





Tk is also doomed, and Tkinter isn't Tk.
You are right about keeping the separate geometry
managers, though.

For starters:http://kenai.com/projects/swank



This looks like a very young project (beta) and i could not find a
widget set. However i will investigate more. Thanks



alpha


However we need to think beyond even a Python community scale. This
problem is inherent in every language community out there. We to unify
the GUI standard. And we are a decade behind in development. (yes i am
completely serious about all of this!).




Then we did find common ground.
-roger
--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter: The good, the bad, and the ugly!

2011-01-18 Thread Arndt Roger Schneider

Adam Skutt schrieb:

On Jan 18, 8:09 am, Arndt Roger Schneider arndt.ro...@addcom.de
wrote:


Back to rantingrick 21st century toolkit/framwork:
Let's have a look at the numbers:
Worlwide pc market are 300 Million pcs per year,
this number includes desktops(2/3) and servers(1/3).
Your gui app is not relevant on servers.



You should tell this fact to just about every major enterprise
software manufacturer out there.  They all ship GUI tools intended to
be used on the server.  Some of them ship only GUI tools or CLI tools
that are worthless, making you use the GUI tools.



The desktop pc market is in decline; there is
however a shift toward pc-servers, instead.
It is anybodies guess how far the pc-desktop decline will go.
Every 21st century toolkit or framework must run on
mobile platforms!



Until we have pixel-perfect touch sensors, toolkits for devices with
pointer interfaces (e.g., PCs) and toolkits for devices with touch
interfaces (e.g., phones and tablets) will necessarily be different.

You note this yourself: the UI paradigms that work well when you have
a pixel-perfect pointer do not work at all when you have a touch
screen, especially on a limited size and resolution display.



Yes I did and that's how it is.


Even if you're provided a single toolkit, you still end up with two,
maybe three, different applications, each using different widgets
targeted for the device they run on.  And no one provides a single
toolkit: while Silverlight can run on the desktop, the web, and now on
Windows Phone, you can't use the same widgets everywhere; ditto with
Cocoa for OS X and Cocoa Touch for iTouch devices.

While some further unification is obviously possible, it's rather
doubtful we'll ever have unified widgets that are truly workable on
the web, on the desktop, and on a portable touch screen device.



Think about all the programmers earning their butter and bread :-).
Forget toolkits and widgets for awhile.
What remains are specific types of human/computer interactions,
a visual representation on a screen and a predefined behaviour
for said human action.

E.g. a button is:
A function gets asychnronously performed in response to
a finger/mouse click and release inside a certain screen area.

--A widget is essentially a logical abstraction.




wxWidgets was written ~1992, it is a copy of
mfc, which in turn is a copy of MacApp. MacApp
is also OSS, maintained through an industrie consortium.
Why do you not use the original framework?




Because it's not cross-platform, I'd imagine.  The entire point of
wxWidgets was to provide a cross-platform OOP UI toolkit.  It
closely copies MFC since MFC and XView were the two backends it
supported.



MacApp is/was cross-platform, Apple pulled the plug
on the non-mac platforms; the industrie
consortium took charge of the other platforms.




Screen resolution:
  The time of 72ppi CRT monitors is over. A GUI
  framework/toolkit must be resolution independent,
  including all icons and indicators;
  it should use decluttering (newspeak:ZUI).




WPF is the only functional resolution-independent UI toolkit in
existence.  While I don't disagree with you in principal, practice is
pretty heavily divorced from principal here.  Principal doesn't help
me write GUI applications today.



wxWidgets is not suitable for a modern type
GUI ad thus clearly not the toolkit/framework
of the 21st century.



None of the toolkits accessible from CPython are suitable for a 21st
century guy by your standard.  If we talk about IronPython,
Silverlight becomes the closest, but it isn't a panacea by any stretch
of the imagination.

Adam


According to Microsoft neither is silverlight.
-roger
--
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Python like lanugages

2011-01-17 Thread Arndt Roger Schneider

Tim Harig schrieb:
[snip]


This isn't such a tragedy Erlang as it is for other managed VMs because
Erlang/BEAM makes powerful usage of its VM for fault tolerance mechanisms.  I
don't know of any other VM that allows software upgrades on a running system.


styx, the distributed operating system inferno, language: limbo.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter: The good, the bad, and the ugly!

2010-12-30 Thread Arndt Roger Schneider

rantingrick schrieb:

On Dec 29, 6:41 pm, Gerry Reno gr...@verizon.net wrote:


wxPython looks good but I don't see anyone developing support for things
like smartphones.



No wx is not the answer to our problems



Rather: ... to *your* problem...




Also, what do you think about frameworks such as pyjamas?  It lets you
write in python and compiles everything down to Javascript so it can be
used across the Web as well as on the desktop.



Hmm, this is like two double edged swords smashing one another in
battle.

Sword One: On one hand web frameworks are going to be really big soon
-- however legacy GUI's are not going away any time soon!


There are enough out there in the wild,
they will last quite for awhile indeed;
but it's time for them to die.



Sword Two: On the other hand web frameworks provide awesome cross
platform ability that is surly only going to get better as time goes
-- however i utterly hate JavaScript (although much worse web
languages exist!). And sending requests back and forth between Python,
JavaScript,


Apparently the authors do know that, too:
MessageID:mailman.1298.1290672551.2218.python-l...@python.org,
*sigh* no svg.

BTW: Look in comp.lang.javascript:
javascript is framework/toolkit resistent.

 and BrowserX is also a real PITA. Because even though

everyone knows this is coming all the major browsers are trying to
insert their API into the mix. So that Joe Scripter has to write code
that is compatible between many browsers. Until the world agrees on a
unified API --AND IMPLEMENTS IT SERIOUSLY-- we are at the mercy of
drunken sailors at the helm.


svg: opera, chrome, safari(including ios), ie9, firefox.
Although svg is missing under webkit/android
--Apple kept the hardware accelerated part to themeselves.
Goolge is currently implementing hardware acceleration for svg in 
chrome/webkit, likewise Microsoft/ie.

Lets wait and see when svg becomes available in android, too.

Although smil is quiet another subject.



I believe pyjamas has a bright future in the web playground, however
we still need to focus our community efforts towards a Python based
GUI. I can see a pythonGUI and pyjamas existing side by side in mutual
harmony for many years.



pyjamas: Perhaps without javascript.

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


Re: Customising Tk widgets

2010-09-21 Thread Arndt Roger Schneider

Peter schrieb:

I am using Windoze, I suspect the appearance attributes I am asking
about here are platform dependent?

Using Tkinter, I would like to generate a Checkbutton that is filled
in with a solid colour rather than a tick mark when selected.



tk = Tk()
tk.option_add(*Checkbutton.inidcatorOn, 0)


Could somebody provide some pointers as to how I could achieve this?

Also, John Shipman's Tkinter reference shows the Radiobutton drawn as
a diamond and yet when I create one in Windows I get a circle - again,
how and where do I need to look to change this behaviour?

Thanks
Peter


Shipman's screenshots are made under Tk 8.4/X11, featureing the
motif look-a-like.

Tk 8.4 follows the windows user style guide (windows95) under windows.

You could still get the motif look under windows:
Tk 8.5 is bundled with a theming engine ttk, this engine
uses the built-in theming engine under windows xp and later,
but also allows you to supplant this engine.
The related ttk theme is called classic.

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


Re: GUIs - A Modest Proposal

2010-06-13 Thread Arndt Roger Schneider

lkcl schrieb:


[snip]

it's the exact same thing for SVG image file-format.  i'm
_definitely_ not convinced that SVG the image fileformat is The One
True Way to design images - but i'm equally definitely convinced of
the power of SVG manipulation libraries which allow for the creation
SVG images using declarative programming.

 



You rather severly underestimate the impact from SVG!
1. SVG is a complete visualization system and not an fancy way to create 
icons.

   SVG and SMIL are an extreme powerful environment. With it's
   possible to create(design) sophisticated graphical and interactive 
--resolution independent--

   applictions without resorting to javascript or direct DOM manipulations.
   Javascript or other languages are still necessary to feed data into 
an SVG

   visualization, but not for much more. Further more SVG and the GPU are
   a natural combination.

2. Many of CSS shiny new features --such as animation originate
  from SVG.
3. SVG-Print: Printing is one of the biggest problems in
  the current IT-landscape. I do not want to install printer
  drivers on each telephon I own, neither on any other device --mobile
  or not. The printer must contain a computer running an OS and has to
  handle an agreed upon page description language (Xml based)...


Using HTML/CSS/DOM/javascript for application building:
Well, yes can be done. HTML is however text oriented; each
application entirely based on this technology will be satured
with text. HTML works reasonable well with applications of the past
two decades, but the importance of text is dwindling and other
graphical means of communication become more and more relevant.


but, all that having been said, and returning to HTML and CSS (the
fileformats), there's a lot to be said for convincing people who are
stuck in those worlds of the benefits and freedom of declarative
programming... _without_ having to get involved directly in
javascript.

 



Any User Interface should be pre-determined;
this concept allows the consequent separation of
application logic and presentation. It's not only important
for Web-applications!


that web apps are about to take over
the world, etc. There is still a place for GUI toolkits 


that
are not based on the DOM,
   



that there definitely are.

 


or whatever the W3C technology of the month is.
   



:) don't underestimate how much time and money is going into the W3C
standards!  and remember, someone's got to implement them, so the
actual proof of the pudding is not what the W3C thinks but whether the
technology ends up actually in the hands of users and is successful
_for users_.

l.

 


The mony part is definitly important. Tk is actually a good example for
the working of money-politics (the absence thereof).

-roger


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


Re: GUIs - A Modest Proposal

2010-06-11 Thread Arndt Roger Schneider

rantingrick schrieb:


On Jun 10, 9:38 pm, Stephen Hansen me+list/pyt...@ixokai.io wrote:

 


Also-- you're just starting to get wrong.

http://docs.python.org/library/tix.html

They don't -call- them the things you are, but between ComboBox, and the
flexibility of HList and TList... it actually offers quite a lot.
   



Urm, do you *know* what a Grid widget is Stephen? (hint: Excel) Do you
*know* what a ListCtrl is Stephen? (Hint: File Browser in report or
iconlabel views) Neither of those widgets exists in the Tix package.
And how do i *know* this? Well because unlike you i have actually
written code with Tix widgets, obviously you have not.

 




All this stuff is present in Tk!

OpenGL:
tkzinc, a 2D visualiation system based on OpenGL,
this one is widley used in air-traffic control...
BTW: tkinc features the best transformation system in the
IT--the author got a patent for it.

canvas3d, OpenGL-3D.

In addition there are *very very very large* visualization systems 
available in Tk:

vtk for example...


ListCtrl --besides that I truely hate this type of controls, an 
aggregation of usablility problems--

tkTreeCtrl is a true clone of MSWIN Explorer


Spreadsheet:
Well, whow doesn't exist in Tix! Are you sure? Hint: look again.
There is tktable, technically well done with on-demand data aquisition,
looks really ugly. An open field to display your artistic prowess.

Once upon a time there was a complete
spreadsheet application written in C++/Tk: abacus.


The TList only displays iconlabels in a wrapping column format, not in
any report mode ala: Windows Explorer(details mode). The HList
widget is for showing a tree structure and is NOTHING like either a
ListCtrl or a Grid.

 



See above.
But notice this windows explorer type sort of thing is a major offence
on other platforms.

My own approach for such an interface function is to use seperate window
types, it reduces the maintainment cost for such an application.


HList:
Well *now* I am speachless. Did you actually even do a superfical
research on the topic?

BLT-tree
bwidget-tree
rtl_tree
hugelist
tkTreeCtrl (mentioned above)
ttk:treectrl
tablelist
tixtreecontrol


Just scanning the docs of a module (that you know jack about) and then
parroting off some baseless arguments are bound to bite you in the
@ss! *egg on face*
 



Please enjoy it.

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


Re: GUIs - A Modest Proposal

2010-06-08 Thread Arndt Roger Schneider

Terry Reedy schrieb:


On 6/7/2010 5:25 PM, Arndt Roger Schneider wrote:


Terry Reedy schrieb:


...


Hah, You are ill-informed.



How about 'under-informed'? That I readily admit ;-)


tkpath 0.3 contains a surface element, which renders vector graphics
elements in an off-screen tk image.



As far as I know, tkpath is either not part of the tk that comes with 
python, or not accessible via tkinter, or not documented.





3x Correct. Tkpath 0.2 is a plugin into tk canvas.
Tkpath 0.3 is a standalone replecement for tk canvas.
The tkpath interface is identical to tk canvas, but it features additional
objects: path, polyline, ppolygon, pline, ptext, circle, ellipse, radial 
gradients,

linear gradients, groups and styles.


The original tk canvas elements are the same as with tkpath,
but the new elements are the tk counterpart to those elements listed inside
the svg 1.1 specification.

As for documentation;
Use the Jeszra book, the svg 1.1 specification and the
ascii text documentation distributed with tkpath.

tkpath bypasses the X-emulation layer for the new elements under Windows
and OSX. CAIRO is the backend under X11.



Forget postscript!



Gladly!


Generate SVG from a tk canvas or --better-- from tkpath.
Jeszra (from me) generates SVG.



I found http://jeszra.sourceforge.net/
It looks interesting but not quite what I need, which is to export a 
tk canvas that I draw on with Python in a form I can import into 
OpenOffice.



OpenOffice does --not yet-- have an svg import filter.
You will have to convert SVG into another format.

For example: use a fo-wrapper around your SVG and convert this
fo-xml into pdf (fop / java).

Other options are: inkscape, adobe illustrator,
gimp--if you can life with a raster image.


I guess SVG import has highest priority within the OpenOffice project
--you wont need such workarounds for long.



 There is also a SVG export


package available in python/tkinter, search the tkinter wiki.



I presume you mean there is a 3rd party python add-on package that 
exports from a tk canvas. Can you be more specific as to what you meant?


Googling 'tkinter wiki' got me to http://tkinter.unpythonic.net/wiki/
wiki.python.org/moin/TkInter has a link to the same.
Searching there for 'svg' title or text has no hits.
Searching PyPI also turns up nothing obvious.

Googling further, I found canvasvg.py at
http://wm.ite.pl/proj/canvas2svg/index.html
via an answer to a question at
http://bytes.com/topic/python/answers/629332-saving-output-turtle-graphics 


I will give it a try.

Terry Jan Reedy


That was it! Be aware only tk canvas elements are exported to SVG by this
package. Jeszra on the other hand converts an entire GUI into SVG.
I don't have any experience with this python package--for obvious reasons.
What you should look after is how raster images are included in the
generated SVG; and try each of the 12 different arrow shapes for tk line.


If you have controls on your canvas:
You may use the screenshot facility of tkImg to create an
image from each control, then embed the screenshot base64 encoded
inside the generated SVG.-


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


Re: GUIs - A Modest Proposal

2010-06-07 Thread Arndt Roger Schneider

Terry Reedy schrieb:


Ant
I agree that the current tk situation is not completely satisfactory. 
In particular, the IO facilities are inadequate and have not, to my 
knowledge, changed in a decade. Image input formats are limited. There 
is no canvas output as an image. (Output of the canvase display list 
as a dialect of postscript that not everything can read is not a 
substitute for this.)




Hah, You are ill-informed.
tkpath 0.3 contains a surface element, which renders vector graphics 
elements

in an off-screen tk image.

Forget postscript!
Generate SVG from  a tk canvas or --better-- from tkpath.
Jeszra (from me) generates SVG. There is also a SVG export
package available in python/tkinter, search the tkinter wiki.


However...
I think it important that Python come with a minimal IDE that is 
adequate for someone like me doing Python-only development. I thank 
the programmers of IDLE. So merely deleting tk/tkinter is not an 
option. Indeed, having something similar to and at least as good as 
IDLE for any candidate gui replacememt should and I think would be a 
requirement for consideration.



Yes, use emacs or vim, without any GUI.

The problem with the big gui application frameworks are that they are 
too big. The two I have glanced at -- wx... and qt -- have much more 
than gui stuff and duplicate parts of the Python stdlib and other 3rd 
party libs.



The question is:
What sort of devices are being used by
*normal* computer owners in the near future?

My guess: It wont be a Desktop Computer.

Will any big GUI-Framework work on those devises?

No!

Will a light-weight GUI-toolkit being ported to these
devices ?

Perhaps, but not likely.

Will any scripting language run on such devices?

Perhaps, but not likely, if then it will be
Ecmascript or a 4GL.

Will SVG run on thoses devices?

Yes, it must, because SVG is an integral part
of OEBPS, and the tiny implementation is already
part most mobile phones. Take a look at SVG for
BlackBerry for instance.



As for a small gui written in Python, you seem to have ignored the 
link to pygui. Of course that has its own problems. Among others: it 
is incomplete; it ignore Python 3 (requires 2.3+ should be 2.3 to 
2.6), which is the only place it could be added; the api sytle is not 
standard in Python (get_xx and set_xx methods instead of direct access 
or properties); and there is nothing yet like IDLE.
What would be required is a Python3 GUI project with multiple 
contributors.


Terry Jan Reedy


What sort of GUI project?


On the initial proposition:
Grapical design is art and art requires an artist.
A community cannot work like an artist. The best a
community of top-class *graphical designers*  could produce
would be of mediocre quality.

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


Re: Python and Tkinter Programming by John Grayson

2010-05-31 Thread Arndt Roger Schneider

Pradeep B schrieb:


On Sat, May 29, 2010 at 7:33 PM, Kevin Walzer k...@codebykevin.com wrote:

 


Tkinter doesn't wrap native printing API's. There are a few extensions that
do it, but they are platform specific and not complete.

The usual ways of printing are like this:

1. If you're outputting data from the text widget, write that to a temporary
text file and print via lpr.

2. If you're outputting data from the canvas, write that to a temporary
postscript file and print via lpr.

This is on Unix/MacOS. Not sure what the equivalent API on Windows is.

--Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
--
http://mail.python.org/mailman/listinfo/python-list

   




Thanx Kevin.

Anybody can throw light on how to do the same in Windows ?

-pradeep


 


The conventional --crude-- way is to take the bitmap of a
window and to stretchDIBBitBlt it onto the printer device in windows
and osx. Native printer dialogs do exist for both platforms ...

When you do not need a printer dialog:
Convert the Tk-GUI to SVG, then wrap it into a fo-xml wrapper
--fo accepts inline SVG-- and use fop for printing.
This approach works cross-platform, albeit you need a Java
intallation (fop is a Java application).

You can use http://jeszra.sourceforge.net to generate SVG for a complete 
Tk-GUI.

In addition. there is a python/tkinter SVG export project for the Tk canvas
--search the tkinter wiki.


-roger

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


Tkinter based libraries Runtime Library 3.0 and Gestalt Items 1.1

2009-11-07 Thread Arndt Roger Schneider

Hi Python commuters,

It is my distinct pleasure to announce the
availability of Runtime Library 3.0
and Gestalt Items 1.1 for Tkinter and Python.

Both libraries are written in Tcl/Tk = version 8.4.
Tkinter based Python Wrapper classes are part of the
libraries, making them accesible from Python.

The libraries contain a wide range of
composite windows for Tk:

Basic Container windows for
* scroll able dialogs
* automatic scrollbar management

Listboxes and Hierarchy
* Combobox
* A edit able listbox (called gistbox)
* Multi-column listboxes
* Tree

A complete AQUA compliant toolbar
infrastructure
* goolbar and zoolbar, toolbars
 implemented in Tk canvas and / or TkPath and
 TkZinc
* gooleditor the associated interactive
 toolbar editor.
* A multi-line toolbar (galette)

Dialogs:
* A dual shell, could serve as an
 interactive Python shell
* A Font selection dialog (Windows design)

tabset, status bar, ...


Take a look at the brand-new manual pages dedicated to Python:
http://gestaltitems.sourceforge.net/python/index.html

There are currently no Python specific examples inside the
Python manual pages, sorry.


Some Details about the Libraries:

All the composite windows
use explicit naming conventions
--they are predeterministic-- to keep
bi-directional communication between
Tcl and Python minimal.

Most of the composite windows either use the
Tk canvas or TkPath pathCanvas window in their
implementation. This makes it possible to convert
all the composites into SVG.
The SVG generator is a separate --unpublished-- tool
and not bundled with the libraries.
The manual pages contain such SVGs generated from Tk.

TkPath is highly recommended to gain a
visually sophisticated GUI. The libraries
do also work without TkPath. TkPath is
based on CAIRO under X11 and bypasses the
Tk X11-emulation layer under Windows and OSX.


Download Packages:
geitems11.tgz -- Gestalt Items Library in Tcl/Tk
geitemsPython11.tgz -- Python classes for above Gestalt Items

rtl30.tgz -- Runtime Library in Tcl/Tk
rtlpython30.tgz -- Python classes for above Runtime Library

Also see the original documentation at:
http://gestaltitems.sourceforge.net

The Runtime Library (Tcl/Tk) is documented by two
books, the latest book is online at:
http://gestaltitems.sourceforge.net/rtl/index.html

The Gestalt Items book:
http://gestaltitems.sourceforge.net/geitems/index.html

All three books contain lots of Tcl/Tk examples
and screen shots (as bitmaps).

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

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


Using python22.dll with Python 2.5?

2008-10-22 Thread Martin Schneider

Hi!

I'd like to use the numpy library (which runs on Python 2.5) in the same 
project with another (mandatory) library which needs python22.dll. When 
I try to compile I get an error similar to python22.dll not compatible 
with the current Python version.


Has anybody an idea how to solve this?

Thanks for your ideas.
Best regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list


  1   2   >