problem with ThreadingTCPServer Handler

2012-10-23 Thread jorge
I'm programming a server that most send a message to each client 
connected to it and nothing else. this is obviously a base of what i 
want to do. the thing is, I made a class wich contains the Handler class 
for the ThreadingTCPServer and starts the server but i don't know how 
can i access the message variable contained in the class from the 
Handler since I have not to instance the Handler by myself.

here is the base code of what I'm doing.

import SocketServer
import socket
from threading import Thread

class CustomTCPServer:
msg = "no message"
outport = 8080

class Handler(SocketServer.BaseRequestHandler):
def handle(self):
self.request.sendall('')


def __init__(self,msg,outport):
self.msg = server
self.outport = outport

def runServer(self):
addr = ('',self.outport)
s = SocketServer.ThreadingTCPServer(addr,self.Handler)
r = Thread(target=s.serve_forever).start()
print '> Server running running',self.server,self.outport


CustomTCPServer('msg1',1212).runServer()
CustomTCPServer('msg2',1213).runServer()

can anyone please help me?

10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS 
INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci
--
http://mail.python.org/mailman/listinfo/python-list


Re: problem with ThreadingTCPServer Handler

2012-10-28 Thread jorge

Tanks a lot, it was really helpful

El 23/10/12 16:51, Miki Tebeka escribió:

According to the docs 
(http://docs.python.org/library/socketserver.html#requesthandler-objects) 
there's self.server available.



10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS 
INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION

http://www.uci.cu
http://www.facebook.com/universidad.uci
http://www.flickr.com/photos/universidad_uci
--
http://mail.python.org/mailman/listinfo/python-list


Get the hard disk hardware serial number

2009-06-03 Thread Jorge
Hi there,

I need to know how to get the hardware serial number of a hard disk in
python.

Thank you in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Hide imports from a module

2009-10-27 Thread Jorge
Hi,
I'm making an executable fiel (win32) with py2exe.
The application is in python 2.6 and uses the firebird driver kinterbasdb.
It make the exe but when the application try to use the kinterbasdb module
gives
this error:
No Module named typeconv_24plus
in this post
http://groups.google.com/group/PyInstaller/tree/browse_frm/month/2007-05?_done=%2Fgroup%2FPyInstaller%2Fbrowse_frm%2Fmonth%2F2007-05%3F&pli=1
mahasamatman say to hide the  'typeconv_24plus' from the imports of
kinterbasdb.

My question is how can I do that?

Thanks in advance for your help.

Regards,

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


Firebird DBs use Kinterbasdb or sqlalchemy?

2009-10-30 Thread Jorge
Hi,
to access firebird data bases which shall I use kinterbasdb or sqlalchemy.

Yes I'm a newbie.

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


Re: comparing alternatives to py2exe

2009-11-04 Thread Jorge
Hi,
in this discussion I read that we con create a bundle executable for our
application,
since I'm having troubles with create a exe due problems with kinterbasdb,
can you
show me tutorials for creating exe from bundle.

thanks in advance.

On Wed, Nov 4, 2009 at 11:21 AM, Vesa Köppä  wrote:

> iu2 wrote:
>
>> Another thing that I think is of interest is whether the application
>> support modifying the version and description of the exe (that is, on
>> Windows, when you right-click on an application and choose
>> 'properties' you view the version number and description of the
>> application, it is a resource inside the exe). I think py2exe supports
>> it.
>>
>
> Pyinstaller supports this.
>
> Vesa
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyQt 2 Exe

2009-11-11 Thread Jorge
search the web, find the sites and follow the instructions.


On Wed, Nov 11, 2009 at 2:11 PM, baboucarr sanneh wrote:

>
> How can i use it ?
>
> *$LIM $...@dy*
>
>
>
>
> --
> Date: Wed, 11 Nov 2009 14:07:47 +
> Subject: Re: PyQt 2 Exe
> From: starglider...@gmail.com
> To: sanne...@hotmail.com
>
>
> py2exe
> pyinstaller
>
> On Wed, Nov 11, 2009 at 1:29 PM, baboucarr sanneh wrote:
>
>  Hi guys,
>
> I wan to make a gui app using pyqt so i have done some thing already now i
> want to save it as an exe file so that i can give it out to users who dont
> have pyqt installed  (windows users)..Please help me out on this one..thnx
>
> Regards
>
> *$LIM $...@dy*
>
>
>
> --
> Keep your friends updated— even when you’re not signed 
> in.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
>
> --
> Windows Live: Keep your friends up to date with what you do 
> online.
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Need to know if a file as only ASCII charaters

2009-06-16 Thread Jorge
Hi there,
I'm making  a application that reads 3 party generated ASCII files, but some
times
the files are corrupted totally or partiality and I need to know if it's a
ASCII file with *nix line terminators.
In linux I can run the file command but the applications should run in
windows.

Any help will be great.

Thank you in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: UTF-EBCDIC encoding?

2013-07-13 Thread Jorge Mazzonelli
Hi,
Regarding your second part of your mail, I have used in the past this
page[1] as a base for code to process a mainframe PS file with packed
decimals. May be it can help you a bit...

Best regards,

Jorge

[1]:
http://www.linuxtopia.org/online_books/programming_books/python_programming/python_ch34s05.html



On Fri, Jul 12, 2013 at 3:11 PM, Wayne Werner  wrote:

> Is anyone aware of a UTF-EBCDIC[1] decoder?
>
> While Python does have a few EBCDIC dialects in the codecs, it does not
> have the (relatively new?) UTF-EBCDIC one.
>
> Additionally, if anyone is aware of a Python tool that can unpack a
> mainframe PDS file, that would also be worthwhile.
>
>
> Thanks,
> Wayne
>
> [1]: 
> https://en.wikipedia.org/wiki/**UTF-EBCDIC<https://en.wikipedia.org/wiki/UTF-EBCDIC>
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>



-- 
-- 
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sending USB commands with Python

2012-08-28 Thread Jorge Mazzonelli
Hi,
I recommend the use of the module PyUSB in sourceforge:
http://pyusb.sourceforge.net/

Also take a look to the tutorial :
http://pyusb.sourceforge.net/docs/1.0/tutorial.html

as far as I can remember, you'll need to first find the device based on the
idvendor / idproduct (provided in the pdf). then you'll need to setup the
configuration (usually the default but on your case you'll need to check
which one, since the doc says there are 2 exposed). then the endpoints.
(all of this is on the tutorial)

With that you need to write the command and then read the result from the
endpoints.
The status command you want will be 0x1B 0x41.

Hope this helps.

Jorge

On Tue, Aug 28, 2012 at 9:04 PM, Adam W.  wrote:

> So I'm trying to get as low level as I can with my Dymo label printer, and
> this method described the PDF
> http://sites.dymo.com/Documents/LW450_Series_Technical_Reference.pdfseems to 
> be it.
>
> I'm unfamiliar with dealing with the USB interface and would greatly
> appreciate it if someone could tell me how to send and receive these
> commands with Python.  Perhaps if you were feeling generous and wanted to
> write a bit of sample code, sending the "Get Printer Status" command and
> receiving the response (page 17 of the PDF) would be perfect to get me on
> my way.
>
> Thanks,
> Adam
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
-- 
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python 2.7 Debian 6.0. Squeeze

2011-05-12 Thread Jorge Romero
Hi all,

My machine is running Debian Squeeze so my default Python runtime is 2.6.6.

According to Python docs *optparse* library is deprecated and the
development will be moved to *argparse*, which is new in Python 2.7.1. So
now that I'm about to write a script that parse command line arguments
thought would be a good idea to do the transition right now, besides the
good comments about this version.

I tried Googling about Python 2.7 on Debian Squeeze, but did not find
anything but discussions -.-. Anyone out there that can point me some
helpful material or anyone who had luck running 2.7 on Debian?

Thanks in advanced.

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


Re: Python 2.7 Debian 6.0. Squeeze

2011-05-12 Thread Jorge Romero
Actually came back with some feedback to my own question.

The following repositories do the job:

# /etc/apt/sources.list
deb http://ftp.uk.debian.org/debian/ unstable main contrib non-free
deb http://ftp.uk.debian.org/debian/ experimental main contrib non-free
deb http://security.debian.org/ testing/updates main contrib

$ apt-get update
$ apt-get install python2.7
$ python --version
Python 2.6.6
$ python2.7 --version
Python 2.7.1+

If you need 2.7 as default runtime:

$ update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10

This is the first time I need two Python instances, so might helpful for
someone in the same position. Any further help feel free to reply.

Cheers.

On Thu, May 12, 2011 at 11:27 AM, Jorge Romero wrote:

> Hi all,
>
> My machine is running Debian Squeeze so my default Python runtime is 2.6.6.
>
> According to Python docs *optparse* library is deprecated and the
> development will be moved to *argparse*, which is new in Python 2.7.1. So
> now that I'm about to write a script that parse command line arguments
> thought would be a good idea to do the transition right now, besides the
> good comments about this version.
>
> I tried Googling about Python 2.7 on Debian Squeeze, but did not find
> anything but discussions -.-. Anyone out there that can point me some
> helpful material or anyone who had luck running 2.7 on Debian?
>
> Thanks in advanced.
>
> --
> Jorge Romero
>
>


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


MySQLdb SEC_TO_TIME function returns datetime.timedelta class

2011-05-15 Thread Jorge Romero
Hi Pythonists,

I'm retrieving some time data from a MySQL database using Python's MySQLdb
library. Here's the situation, I got a time field on MySQL given in seconds,
I need it on HH:MM:SS format, so I'm SELECTING that field with SEC_TO_TIME
function, something like this:

query = "SELECT SEC_TO_TIME(SUM(seconds)) FROM table"
fetched = cursor.execute(query)
return fetched[0]

The result of the query is given to me as *datetime.timedelta *type, which
has an undesired print behavior for my purposes:

>>> query = "SELECT SEC_TO_TIME(SUM(seconds)) FROM table"
>>> fetched = cursor.execute(query)
>>> print fetched[0]
3 days, 7:30:09
>>> print type(fetched[0])


Instead of *datetime.timedelta *I need *datetime.time *type. Does anybody
knows how to change this behavior or is it something I must deal with my
code?

Thanks in advanced.

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


Re: MySQLdb SEC_TO_TIME function returns datetime.timedelta class

2011-05-15 Thread Jorge Romero
On Sun, May 15, 2011 at 11:50 PM, Chris Angelico  wrote:

> On Mon, May 16, 2011 at 10:42 AM, Jorge Romero 
> wrote:
> > Hi Pythonists,
> > I'm retrieving some time data from a MySQL database using Python's
> MySQLdb
> > library. Here's the situation, I got a time field on MySQL given in
> seconds,
> > I need it on HH:MM:SS format, so I'm SELECTING that field with
> SEC_TO_TIME
> > function, something like this:
> > query = "SELECT SEC_TO_TIME(SUM(seconds)) FROM table"
>
> You're summing a column, so presumably the values are actually deltas
> (it doesn't make sense, for instance, to add Tues March 16th to Sat
> Nov 2nd). The result exceeds a day; in what format do you actually
> want it?
>
> For maximum flexibility, you could ditch the SEC_TO_TIME call and
> simply work with the integer seconds in Python. You can then format
> that into H:MM:SS or whatever suits you.
>
> Chris Angelico
> --
> http://mail.python.org/mailman/listinfo/python-list
>


Yeah, I believe that's the way to go, retrieve seconds and deal with them
with Python, for flexibility as you pointed. I need the seconds to become
HH:MM:SS format.

What seems weird to me is why MySQLdb treats the result of the query as
deltas. Here's what I get if a query directly the database, output from PHP
MyAdmin:

SEC_TO_TIME(SUM(billsec))
*79:30:09*
*
*
*This value suits better the datetime.time type, instead of
datetime.deltatime.
*

Thanks Chris for your feedback.

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


Re: Python 3 vs Python 2.7 dilemma

2011-05-17 Thread Jorge Romero
I would recommend you going on the Python 2.x path.

Python 2.x is far from being deprecated. According to Wesley Chun (active
member of Python community and author of Core Python Programming) on a
Google I/O talk, everybody will be using Python 3 by 2018, so there's still
plenty of time. Besides, you can start with Python 2.7, which still is 2.x
but introduces 3.x features, and in some benchmarks seems to be more
efficient than latest 3.x.

3.x is said to be backwards incompatible, but that incompatibility is not
something that would bring you a limitation on porting your code later.

So, for the sake of web frameworks and runtime infrastructures, I'd stick to
2.x.

This is my IMHO, I'm sure you can get a more accurate answer from someone in
this list more experienced in the matter ;)

Have a good one.

On Tue, May 17, 2011 at 12:48 AM, Navkirat Singh wrote:

> Hi Guys,
>
> I have been trying to fight this issue for sometime now. I know that a
> large part of the python 3rd party software base has not been ported to
> python 3 yet. I am trying to build a web-based enterprise solution for my
> client. Most of reputed frameworks like Django and Turbo gears are yet in
> the 2.x stage. I know that these frameworks are extremely good. But I wanted
> to build my base with python 3 as that is what is going to prevail in the
> future.
>
> I have built my own little architecture using python3. Here is what I have
> accomplished till now:
>
> a) A multiprocessing webserver built directly using low level sockets for
> maximum control, conforming to RFC 2616 (not completely right now).
> b) A HTTP message parser  for parsing HTTP/1.1 requests and generating
> response messages
> c) A session control base using python multiprocessing dictionary manager
> d) A partially build MVC model, without a templating engine at the moment.
> I am planning to put Jinja 3 there.
>
> I have spent months of free time doing this. I have learnt a lot, but well
> I am not sure if the path I am on is the right one.
>
> My question to everyone is whether I should go ahead with this approach, or
> should I just use 2.x technology? I am not sure if I will be able to port
> all the code to python3 later.
>
> I will really appreciate any input.
>
> Thanks and regards,
> Navkirat
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>


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


Re: newb question about @property

2017-10-03 Thread Jorge Gimeno
No, I see this as teaching the skills involved to drive a car. Practicing a
turn, scanning gauges, and checking blind spots are all a part of driving.
When one is learning, it's easier to learn these in isolation so when the
problem must be solved in real time, you know what to do. This is no
different. You may never need to use a decorator ever in your development
career, but the tool is there in case the problem you have can be elegantly
solved using one.

-Jorge

On Tue, Oct 3, 2017 at 8:00 AM, bartc  wrote:

> On 03/10/2017 15:39, Ian Kelly wrote:
>
>> On Tue, Oct 3, 2017 at 4:41 AM, Steve D'Aprano
>>  wrote:
>>
>>> On Tue, 3 Oct 2017 06:51 am, Bill wrote:
>>>
>>> Can you inspire me with a good decorator problem (standard homework
>>>> exercise-level will be fine)?
>>>>
>>>
>>>
>>> Here is a nice even dozen problems for you. Please ask for clarification
>>> if any
>>> are unclear.
>>>
>>>
>>>
>>> (1) Write a decorator which simply prints a descriptive message and the
>>> name of
>>> the decorated function once, when the function is first decorated.
>>>
>>> E.g. if you write:
>>>
>>> @decorate
>>> def spam(x):
>>>  return x + 1  # for example
>>>
>>> print(spam(1))
>>> print(spam(2))
>>>
>>>
>>> Python should print:
>>>
>>> Decorating function spam.
>>> 2
>>> 3
>>>
>>>
>>> Note: "spam" must not be hard-coded, it must be taken from the function
>>> being
>>> decorated. (Hint: all functions have their name available as
>>> func.__name__.)
>>>
>>>
>>> (2) Modify the decorator from (1) so that calling the wrapped function
>>> also
>>> print a descriptive message such as "Calling function spam". The expected
>>> output will be:
>>>
>>> Decorating function spam.
>>> Calling function spam.
>>> 2
>>> Calling function spam.
>>> 3
>>>
>>>
>>> (3) Write a decorator that checks that the decorated function's first
>>> argument
>>> is a non-empty string, raising an appropriate exception if it is not,
>>> and lets
>>> through any other arguments unchanged.
>>>
>>>
>>> (4) Same as above, except the first argument is automatically stripped of
>>> leading and trailing whitespace and forced to uppercase.
>>>
>>>
>>> (5) Write a decorator which injects the argument 10 into the list of
>>> arguments
>>> received by the wrapped function. E.g. if you write:
>>>
>>> @inject
>>> def add(a, b):
>>>  return a + b
>>>
>>> @inject
>>> def sub(a, b):
>>>  return a - b
>>>
>>> print(add(5), sub(5))
>>>
>>> Python should print "15 5". (And *not* "15 -5".)
>>>
>>>
>>> (6) [ADVANCED] Modify the decorator in (5) so that it takes an argument
>>> telling
>>> it what value to inject into the list of arguments:
>>>
>>> @inject(99)
>>> def sub(a, b):
>>>  return a - b
>>>
>>> print(sub(5))
>>>
>>> will now print "94".
>>>
>>>
>>> (7) Write a decorator which checks the decorated function's two
>>> arguments are
>>> given smallest first, swapping them around if needed.
>>>
>>>
>>> (8) Write a decorator which prints the name of the wrapped function, its
>>> arguments, and the time, each time the wrapped function is called.
>>>
>>>
>>> (9) [ADVANCED] Modify the decorator from (8) to take an argument
>>> specifying the
>>> path to a file, and use the logging module to log the details to that
>>> file
>>> instead of printing them.
>>>
>>>
>>> (10) Write a decorator which adds an "cache" attribute initialised to an
>>> empty
>>> dictionary to the decorated function.
>>>
>>>
>>> (11) Write a decorator which wraps a class (not function!), and adds a
>>> "help"
>>> method to the class which prints a message as shown below. For example:
>>>
>>> @addhelp
>>> class Spam:
>>>  pass
>>>
>>> @addhelp
>>> class Eggs:
>>>  pass
>>>
>>> x = Spam()
>>> x.help()
>>> y = Eggs()
>>> y.help()
>>>
>>> will print:
>>>
>>> See http://example.com/Spam
>>> See http://example.com/Eggs
>>>
>>> (Hint: classes also have a __name__ attribute.)
>>>
>>>
>>> (12) [ADVANCED] Write a decorator which wraps a class, and applies the
>>> decorator
>>> from (10) above to each non-dunder¹ method in the class. That is, after:
>>>
>>> @addcaches
>>> class MyClass:
>>>  def foo(self):
>>>  pass
>>>  def bar(self):
>>>  pass
>>>
>>> print(MyClass.foo.cache, MyClass.bar.cache)
>>>
>>> should print "{} {}".
>>>
>>>
>>>
>>> ¹ Remember that dunder methods are those that start with two leading and
>>> trailing underscores: "Double UNDERscore" methods.
>>>
>>
> [Sorry can't see Steve's original post.]
>
> Does all this advanced stuff (which I don't understand and which doesn't
> look very appealing either; hopefully I will never come across such code)
> still count as programming?
>
> It seems to me the equivalent of an advanced driving course teaching you
> how to customise your car rather than involving any actual driving.
>
> --
> bartc
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: exception should not stop program.

2017-10-07 Thread Jorge Gimeno
Catching all exceptions in a try-except block is almost always a bad idea.
You can't tell the difference between an exception that you are looking to
handle and an exception that should cause your program to crash and burn
(because something is wrong). It's best to catch a specific exception.
What condition are you looking to handle here?

-Jorge

On Sat, Oct 7, 2017 at 9:38 AM, Prabu T.S.  wrote:

> I would like to continue to second function invocation
> "checkServiceStatus('AdobeARMservice')" even if the first
>checkServiceStatus('Tomcat9')  has any exception.Please advice.Second
> function invocation not getting executed if any exception occurs in
> first.Please advice.
>
>
> import psutil
>
> def checkServiceStatus(server):
> status = None
> try:
> service = psutil.win_service_get(server)
> status = service.as_dict()
> print("%s (%s)" % (status['name'], status['display_name']))
> print("status: %s, start: %s, username: %s, pid: %s" % (
> status['status'], status['start_type'], status['username'],
> status['pid']))
> print("binpath: %s" % status['binpath'])
> print(" ")
> except Exception:
> pass
> return status
>
> checkServiceStatus('Tomcat9')
> checkServiceStatus('AdobeARMservice')
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


plot map wit box axes

2017-12-22 Thread jorge . conrado


Hi,

I use the PYTHON and IDL. In IDL I can plot a grid map like a this 
figure (mapa.png). Please, I would like know how can I plot my figure 
using PYTHON with the box around the figure. Like this that I plot using 
the IDL.


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


Python goto

2017-12-28 Thread jorge . conrado



Hi,

I would like to know if there is a goto command or something similar 
that I can use in Python.


Thanks,

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


Plot map wit a white and black box

2018-01-08 Thread jorge . conrado

Hi,

Please, I woudl like to plot a map like this figure. How can I do this 
using Python2.7


Thanks,

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


close figure after plot

2018-01-22 Thread jorge . conrado

Hi,

I have several satellite data (500 images). I read it and plot using 
plt.show(). I would like know how can I delete the window after  I save 
the image. I use plt.close(), plt.close('all') but these options didn't 
work.


Thanks,

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


Read satellite images

2018-01-24 Thread jorge . conrado



Hi,

I have some gridded 4Km satellite images. I don't have experience with 
Python. The size of my image is (9896,3298) and I use this to read


f = open('merg_2018011100_4km-pixel', "r")  # reopen the file

x = f.read()

print (x[0])


I have this value for x = �


This is the information for this data from where I did the ftp: the data 
is 1-byte.


Please, what can I do to get the value in ascii.


Thanks,

Conrado



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


TIME IN XARRAY

2021-04-15 Thread Jorge Conforte



Hi,


I'm using xarray to read netcdf data and I had to time in my data the 
values:



xarray.DataArray 'time' (time: 507)>
array(['1979-01-01T00:00:00.0', '1979-02-01T00:00:00.0',
   '1979-03-01T00:00:00.0', ..., 
'2021-01-01T00:00:00.0',

   '2021-02-01T00:00:00.0', '2021-03-01T00:00:00.0'],
  dtype='datetime64[ns]')


Please, how can I get the years and months values from this array.


Thanks,


Conrado

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


Plot maps in 3D

2021-04-28 Thread Jorge Conforte



Hi,


I would like know if it is posible to plot the south in north poles in 
3D earth maps. I search in google and always all examples is for 
cylindric projection, like this:





bm = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[2],
 urcrnrlon=extent[1], urcrnrlat=extent[3],
 projection='cyl', resolution='l', fix_aspect=False, ax=ax)


I try to use the spstere or npstere and I didn't have success. I would 
like know it is possible use these projections to plot 3D data.



Thanks,


Conrado

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


Xarray smoothing data

2021-07-02 Thread Jorge Conforte



Hi,


I'm using xarray to read and plot my netcdf data. Please someone could 
help me, dow can I smooth my data before to plot i.



Thanks,


Conrado

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


NUmpy

2021-09-29 Thread Jorge Conforte



Hi,

I have a netcdf file "uwnd_850_1981.nc" and I'm using the commands to 
read it:


from numpy import dtype
 fileu ='uwnd_850_1981.nc'
ncu = Dataset(fileu,'r')
uwnd=ncu.variables['uwnd'][:]


and I had:

:1: DeprecationWarning: `np.bool` is a deprecated alias for the 
builtin `bool`. To silence this warning, use `bool` by itself. Doing 
this will not modify any behavior and is safe. If you specifically 
wanted the numpy scalar type, use `np.bool_` here.
Deprecated in NumPy 1.20; for more details and guidance: 
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations


I didn't how I have this message. My numpy verison is 1.21.2.


Please, how can I solve this.


Thanks,


Conrado

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


Python LSTM forecast future values for time series

2022-02-10 Thread Jorge Conforte


HI,


I'm starting run the LSTM to forecast future values for time serie data.

please can someone give me some information on how i can predict future 
values ​​for my time series using LSTM. Thanks, Conrado


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


Numpy error

2017-01-03 Thread jorge . conrado



Hi,


I alredy used Python and now I have the message:

import numpy as np
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/home/conrado/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy-1.8.0-py2.7-linux-x86_64.egg/numpy/__init__.py", 
line 153, in 

from . import add_newdocs
  File 
"/home/conrado/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy-1.8.0-py2.7-linux-x86_64.egg/numpy/add_newdocs.py", 
line 13, in 

from numpy.lib import add_newdoc
  File 
"/home/conrado/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy-1.8.0-py2.7-linux-x86_64.egg/numpy/lib/__init__.py", 
line 18, in 

from .polynomial import *
  File 
"/home/conrado/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy-1.8.0-py2.7-linux-x86_64.egg/numpy/lib/polynomial.py", 
line 19, in 

from numpy.linalg import eigvals, lstsq, inv
  File 
"/home/conrado/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy-1.8.0-py2.7-linux-x86_64.egg/numpy/linalg/__init__.py", 
line 50, in 

from .linalg import *
  File 
"/home/conrado/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy-1.8.0-py2.7-linux-x86_64.egg/numpy/linalg/linalg.py", 
line 29, in 

from numpy.linalg import lapack_lite, _umath_linalg
ImportError: 
/home/conrado/Canopy/appdata/canopy-1.5.5.3123.rh5-x86_64/lib/libgfortran.so.3: 
version `GFORTRAN_1.4' not found (required by /lib64/liblapack.so.3)



I did:  pip istall --user numpy


Requirement already satisfied: numpy in 
/home/conrado/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy-1.8.0-py2.7-linux-x86_64.egg



What can I do to solve this message.


Thanks,


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


netcdf 4 error

2018-03-29 Thread jorge . conrado


Hi,

Here are some information of my netcdf4 data:

NetCDF dimension information:
Name: lon
size: 4320
type: dtype('float64')
Name: lat
size: 2160
type: dtype('float64')
Name: time
size: 12
type: dtype('float64')
NetCDF variable information:
Name: satellites
dimensions: (u'time',)
size: 12
type: dtype('int16')
Name: ndvi
dimensions: (u'time', u'lat', u'lon')
size: 111974400
type: dtype('int16')
units: u'1'
scale: u'x 1'
missing_value: -5000.0
valid_range: array([-0.3,  1. ])
Name: percentile
dimensions: (u'time', u'lat', u'lon')
size: 111974400
type: dtype('int16')
units: u'%'
scale: u'x 10'
flags: u'flag 0: from dataflag 1: spline 
interpolation flag 2: possible snow/cloud cover'

valid_range: u'flag*2000 + [0 1000]'




then I use to read my data:



nc_f = './ndvi3g_geo_v1_1981_0712.nc4'

nc_fid = nc4.Dataset(nc_f,'r')

nc_attrs, nc_dims, nc_vars = ncdump(nc_fid)

print ()

# EXTRAI AS VARIAVEIS DO ARQUIVO NETCDF

lats = nc_fid.variables['lat'][:]
lons = nc_fid.variables['lon'][:]
time = nc_fid.variables['time'][:]


ndvi1 = nc_fid.variables['ndvi'][:]


But, I had this message:


lerndvias1.py:98: UserWarning: WARNING: valid_range not used since it
cannot be safely cast to variable data type
  ndvi1 = nc_fid.variables['ndvi'][:]


Please, what can I do to solve this.


Thanks,


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


www.python.org down

2018-04-30 Thread Jorge Gimeno
Not sure who to report to, but the site comes back with a 503. Anyone know
where I can direct this to?

-Jorge L. Gimeno
-- 
https://mail.python.org/mailman/listinfo/python-list


Masking using shapefiles

2018-05-02 Thread jorge . conrado



 Hi,

 I'm trying to make a mask using a shapefile of Brazil using the 
examplE:


 http://basemaptutorial.readthedocs.io/en/latest/clip.html


 I run my script and I had the messages:

 Traceback (most recent call last):
  File "mascarapy2.py", line 7, in 
from osgeo import gdal
  File 
"/home/conrado/anaconda3/lib/python2.7/site-packages/osgeo/__init__.py", 
line 21, in 

_gdal = swig_import_helper()
  File 
"/home/conrado/anaconda3/lib/python2.7/site-packages/osgeo/__init__.py", 
line 17, in swig_import_helper

_mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: 
/home/conrado/anaconda3/lib/python2.7/site-packages/osgeo/../../.././libkea.so.1.4.7: 
undefined symbol: 
_ZN2H56H5FileC1ERKSsjRKNS_17FileCreatPropListERKNS_15FileAccPropListE



   Please, what can I do to solve this.

   Thanks,

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


Re: version

2018-05-31 Thread Jorge Gimeno
Look at the six module

On Thu, May 31, 2018, 7:57 PM Mike McClain  wrote:

> OK so I installed python 3.2, which is the latest available as a
> package in Debian Wheezy, because I've seen so many folks say it's a
> waste of time to play with Py2.7.
> Immediately my python playground 'my.python.py' failed as soon as
> I changes the '#!' line to python3.2.
> Most of the errors were because I had used 'print' without parens
> which 2.7 liked but 3.2 doesn't.
> Is there a way in a script to know which version of python is being
> run so I can write:
> If (version == 2.7):
> do it this way
> elsif (version == 3.2):
> do it another way
>
> Thanks,
> Mike
> --
> I Don't care how little your country is, you got a right to run it like
> you want to. When big nations quit meddling then the world will have peace.
> - Will Rogers
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Python 2.7.14 and Python 3.6.0 netcdf4

2018-07-23 Thread jorge . conrado




 Hi,

 Please someone can help me with this error message;


 for Python 2.7.14 I did:

 from netCDF4 import Dataset

 and I didn't have no message



 But, for Python 3.6.0

 from netCDF4 import Dataset

 I had:

 Traceback (most recent call last):
 File "", line 1, in 
 ModuleNotFoundError: No module named 'netCDF4'


 What can I do to solve this error for Python 3.6.0


 Thanks,


 Conrado

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


ImportError: libpoppler.so.76

2018-08-08 Thread jorge . conrado




  Hi,

  I downloade an example from:


  http://basemaptutorial.readthedocs.io/en/latest/clip.html


  from mpl_toolkits.basemap import Basemap
from matplotlib.path import Path
from matplotlib.patches import PathPatch
import matplotlib.pyplot as plt
from osgeo import gdal
import numpy
import shapefile

fig = plt.figure()
ax = fig.add_subplot(111)

sf = shapefile.Reader("ne_10m_admin_0_countries")

for shape_rec in sf.shapeRecords():
if shape_rec.record[3] == 'Andorra':
vertices = []
codes = []
pts = shape_rec.shape.points
prt = list(shape_rec.shape.parts) + [len(pts)]
for i in range(len(prt) - 1):
for j in range(prt[i], prt[i+1]):
vertices.append((pts[j][0], pts[j][1]))
codes += [Path.MOVETO]
codes += [Path.LINETO] * (prt[i+1] - prt[i] -2)
codes += [Path.CLOSEPOLY]
clip = Path(vertices, codes)
clip = PathPatch(clip, transform=ax.transData)


m = Basemap(llcrnrlon=1.4,
llcrnrlat=42.4,
urcrnrlon=1.77,
urcrnrlat=42.7,
resolution = None,
projection = 'cyl')

ds = gdal.Open('srtm_37_04.tif')
data = ds.ReadAsArray()

gt = ds.GetGeoTransform()
x = numpy.linspace(gt[0], gt[0] + gt[1] * data.shape[1], data.shape[1])
y = numpy.linspace(gt[3], gt[3] + gt[5] * data.shape[0], data.shape[0])

xx, yy = numpy.meshgrid(x, y)

cs = m.contourf(xx,yy,data,range(0, 3600, 200))

for contour in cs.collections:
contour.set_clip_path(clip)

plt.show()



Then I did.

python3 for this script and I had:




 python mascara.py
Traceback (most recent call last):
  File "mascara.py", line 5, in 
from osgeo import gdal
  File 
"/home/conrado/anaconda3/lib/python2.7/site-packages/osgeo/__init__.py", 
line 21, in 

_gdal = swig_import_helper()
  File 
"/home/conrado/anaconda3/lib/python2.7/site-packages/osgeo/__init__.py", 
line 17, in swig_import_helper

_mod = imp.load_module('_gdal', fp, pathname, description)
ImportError: libpoppler.so.76: cannot open shared object file: No such 
file or directory




Please, what can I do to solve this.


Thanks,


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


Fwd: Operator Precedence/Boolean Logic

2016-06-22 Thread Jorge Gimeno
On Tue, Jun 21, 2016 at 8:40 PM, Elizabeth Weiss  wrote:

> Hi There,
>
> I am a little confused as to how this is False:
>
> False==(False or True)
>
> I would think it is True because False==False is true.
>
> I think the parenthesis are confusing me.
>
> (False==False) or True
>
> This is True. Is it because False==False? And True==False is not True but
> that does not change that this is True.
>
> If someone could please explain as I am teaching Python to myself and am
> stuck on this that would be great.
> Thank you for your help!
> --
> https://mail.python.org/mailman/listinfo/python-list
>

You have 2 comparisons here .  The first is inside the parenthesis, (False
or True) evaluates to True.  What remains of the expression is False ==
True, which is False.

-Jorge
(Reposted because I replied to the OP directly, instead of to the list)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyCharm installation

2019-05-19 Thread Jorge Gimeno
On Sun, May 19, 2019, 3:27 AM Syed Rizvi  wrote:

> Hi,
>
> I tried to install PyCharm. First time when I installed it, it worked
> well. It developed some problem and when I reinstalled PyCharm, it gives me
> error. I have installed it several times but could not install it
>
> I am unable to install PyCharm.
> --
> https://mail.python.org/mailman/listinfo/python-list


Without the error message there isn't much we can do. Can you please copy
and paste the error message?

-Jorge

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


Window and position of figure

2020-04-04 Thread jorge . conforte
 

Hi, 

I already use the IDL software. Now I`m using Python. In IDL I
havethe vector position=(xo,yo,x1,y1) to set where Iwnat to plot my
figure in my window. 

I have an 2d array with x and y dimensition equal
5224. when I plot my figure, using contourtf it takes up a small part of
my window. What can I do to have 

my figure occupy a larger area in my
window.

Thanks,

Conrado

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


Python dependences

2020-04-21 Thread jorge . conforte
 

Hi, 

I've already used the python list to clear up some doubts.
It's been about a year since I started using Python in my projects and I
still have some doubts. For those who have always used IDL, this change
is a little difficult. I already have Ptyhon 3.8 installed, on Linux. To
clear up any doubts, what is the best method to install Python
dependencies, for example: numpy, matplolib, netcdf, gdal, etc. Should I
use PIP, conda or install using Conda. What I do so that all
dependencies are installed in the same directory. I installed GDAl and
now I can only use it as root. If you use it as a common user, it always
gives an error message. There is a method that I can uninstall all
dependencies and install them using PIP, so that they are all in the
same directory. This question and that I want to use only Python. And I
already installed some dependencies, and some give me an error message.
For example:

import matplolib

Traceback (most recent call last):

File
 line 1, in 

ModuleNotFoundError: No module named


Excuse me for this long question. And that I want to stop
using IDL and dedicate myself entirely to Python.

Thanks.

Conrado

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


Re: number of python users

2005-09-28 Thread Jorge Godoy
Bryan <[EMAIL PROTECTED]> writes:

> just for fun, i looked at the top linux distros at distrowatch and looked at
> what version of python the latest released version is shipping with out of the
> box:
> 
> 1. ubuntu hoary - python 2.4.1
> 2. mandriva 2005 - python 2.4
> 3. suse 9.3 - python 2.4

3.1. OpenSuSE 10 will be coming out with Python 2.4.1 as well.


Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: converting Word to MediaWiki

2005-09-29 Thread Jorge Godoy
Peter Hansen <[EMAIL PROTECTED]> writes:

> Are the two necessarily in conflict?  Perl can save your butt and _still_ 
> suck!

If it pays the bill... :-)

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: A Moronicity of Guido van Rossum

2005-09-29 Thread Jorge Godoy
Michael Goettsche <[EMAIL PROTECTED]> writes:

> On Thursday 29 September 2005 16:24, Xah Lee wrote:
> > A Moronicity of Guido van Rossum
> >
> > Xah Lee, 200509
> >
> 
> Assuming you want to reach people to convince them your position is right, 
> why 
> don't you try that in proper language? "moron" occured 7 times in your not 
> too long text, that doesn't let you look like a tech moron or a math moron, 
> but just like a moron.

His intent was never to convince people or pass information.  Look for older
posts from him, where people here tried showing him some mistakes or made
suggestions to enhance his contribution and he simply ignored everything.

It looks like he thinks he's omniscient and always righ.  Almost (?) a
deity. :-) 


By the way, the doctor said it is dangerous to contradict him... ;-)

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Parser suggestion

2005-09-29 Thread Jorge Godoy

Hi!


I'm needing a parser to retrieve some information from source code --
including parts of code -- from Fortran, to use in a project with a
documentation system.

Any recommendations on a Python app or parser that I could use for that? 


Thanks,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Parser suggestion

2005-09-29 Thread Jorge Godoy
"Michael J. Fromberger" <[EMAIL PROTECTED]> writes:

> There seems to be a great diversity of parsing tools available for 
> Python programmers.  Here are a few suggestions to get you started:

>From Google I found almost all of those.  But do you have any suggestion on
which one would be better to parse Fortran code?  Or more productive to use
for this task? 

> PLY (Python Lex/Yacc)
>   http://www.dabeaz.com/ply/

This is new to me :-)

> PyParsing
>   http://pyparsing.sourceforge.net/

>From what I was seeing, this seems to be a good one to try... 

> SPARK (Scanning Parsing And Rewriting Kit)
>   http://pages.cpsc.ucalgary.ca/~aycock/spark/

It looks like it stopped being developed circa 2002...  From 2002 to now
Python had a lot of improvements and I'd rather use a maintained tool for this
project.  At least one that keeps up with Python's development... 


> You might also find the following an interesting read, if this sort of 
> thing interests you:
>   http://www.python.org/sigs/parser-sig/towards-standard.html

I will.  But this is basically for "one project only".  Other structures are
usually simpler than a programming language and can be retrieved with
different approaches.


Thank you very much for your suggestions.


Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parser suggestion

2005-09-29 Thread Jorge Godoy
Steven Bethard <[EMAIL PROTECTED]> writes:

> Jorge Godoy wrote:
> > From Google I found almost all of those.  But do you have any suggestion on
> > which one would be better to parse Fortran code?  Or more productive to use
> > for this task?
> [snip]
> >
> >>PyParsing
> >>  http://pyparsing.sourceforge.net/
> 
> Well, I've never had to parse Fortan code, but I've had a lot of success
> writing a variety of recursive grammars in PyParsing.  I'd highly recommend at
> least trying it out.
> 
> STeVe

I've downloaded it.  The interesting thing is that there are some examples
that parses things more complex than "2+3*8" :-)



-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parser suggestion

2005-09-29 Thread Jorge Godoy
François Pinard <[EMAIL PROTECTED]> writes:

> [Jorge Godoy]
> 
> > > SPARK (Scanning Parsing And Rewriting Kit)
> > >   http://pages.cpsc.ucalgary.ca/~aycock/spark/
> 
> > It looks like it stopped being developed circa 2002...  From 2002 to
> > now Python had a lot of improvements and I'd rather use a maintained
> > tool for this project.  At least one that keeps up with Python's
> > development...
> 
> While this way of thinking is in the fashion, and often happens to be
> right, it does not really apply in the SPARK case.
> 
> SPARK works fine and well, and is probably the most elegant and pythonic
> of the series.  If it it does not really need to be further developed,
> and does not have much to gain from recent Python releases, I do not see
> why it should be released once in a while merely to entertain the crowd.

I don't consider it entertainment.  Just code maintenance.

How can I be sure that if I find a bug I'll be able to discuss it with the
developer if it's 3 years since the last release of his code? 

You're someone I admire and with whom I've worked before -- with documentation
--, so I consider your opinion a lot and will give SPARK a look based on your
recommendation. 

But, I still think that 3 years without any new implementation, design change
or maintenance release is a huge ammount of time; specially in our area where
technology evolves really fast and new concepts are always popping up.


Thanks a lot for your opinion and for trying to open my eyes, François.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Python vs Ruby

2005-10-24 Thread Jorge Godoy
[EMAIL PROTECTED] (Alex Martelli) writes:

> forwards a lot to Python 3.0!-).  But -- the "dream" solution would be
> to work closely with customers from the start, XP-style, so features go
> into the code in descending order of urgence and importance and it's
> hardly ever necessary to remove them.

We do that often with two of our customers here.  After the first changes,
they asked for more.  And them some other and when it finally ended, the
project was like we had suggested, but instead of doing this directly, the
client wanted to waste more money... :-(  Even if we earnt more money, I'd
rather have the first proposal accepted instead of wasting time working on
what they called "essential features". 

> But if I had do nominate ONE use case for "making code smaller" it would
> be: "Once, And Only Once" (aka "Don't Repeat Yourself").  Scan your code
> ceaselessly mercilessly looking for duplications and refactor just as
> mercilessly when you find them, "abstracting the up" into functions,
> base classes, etc...

And I'd second that.  Code can be drastically reduced this way and even
better: it can be made more generic, more useful and robustness is improved. 

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: more than 100 capturing groups in a regex

2005-10-25 Thread Jorge Godoy
"Joerg Schuster" <[EMAIL PROTECTED]> writes:

> No limitation at all would be best. If a limitation is necessary, then
> the more capturing groups, the better. At the time being, I would be
> really happy about having the possibility to use 1 capturing
> groups.

I'm sorry, I missed the beginning of this thread and it has already expired on
my news server, but what is the reason for so much capturing groups?  I
imagine that coding this and keeping code maintenable is a huge effort.  Oh,
and I came from Perl, where I used to think in regexps...  In Python I almost
never use them. 

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: more than 100 capturing groups in a regex

2005-10-25 Thread Jorge Godoy
"Joerg Schuster" <[EMAIL PROTECTED]> writes:

>> but what is the reason for so much capturing groups?  I
>> imagine that coding this and keeping code maintenable is a huge effort.
>
> User input is compiled to regular expressions. The user does not have
> to worry about those groups.

And what is the problem with something like getopt, optparse, etc.? 

And 10K groups on a single input line?  

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scanning a file

2005-10-28 Thread Jorge Godoy
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

> Which is quite fast. The only problems is that the file might be huge.
> I really have no need for reading the entire file into a string as I am
> doing here. All I want is to count occurences this substring. Can I
> somehow count occurences in a file without reading it into a string
> first?

How about iterating through the file?  You can read it line by line, two lines
at a time.  Pseudocode follows:

line1 = read_line
while line2 = read_line:
  line_to_check = ''.join([line1, line2])
  check_for_desired_string
  line1 = line2

With that you always have two lines in the buffer and you can check all of
them for your desired string, no matter what the size of the file is.


Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tachometer diagram

2005-10-31 Thread Jorge Godoy
"Andreas Kaiser" <[EMAIL PROTECTED]> writes:

> I'am searching for a python solution for display a tachometer diagram.
> I prefer a solution for wxPython.
> The plot libraries I've found do not implement this diagram type.
> Any hints welcome!

In case you change your mind, I believe there's such a thing in Qt3.  Using
pyQt you could use that.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tachometer diagram

2005-10-31 Thread Jorge Godoy
"Andreas Kaiser" <[EMAIL PROTECTED]> writes:

> I can change my mind, sorry. The target OS for this app is Win. When
> pyQt4 is available, I will check QT.

Dunnon the licensing, but there's a Qt3 GPL available for Win...  It is not
official, but it runs :-)  You'd have to Google for it, though, since I don't
have the URL for it anymore.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: data hiding/namespace pollution

2005-10-31 Thread Jorge Godoy
Alex Hunsley <[EMAIL PROTECTED]> writes:

> Sorry, I wasn't being clear. What I should have said is that I don't like the
> idea of a typo in an assignment causing the assigning of the wrong thing.
> e.g. imagine a simple value-holding class:
> 
> class Values:
>   pass
> 
> v = Values()
> 
> v.conductoin = 10
> 
> 
> ... I meant to type 'conduction' in the source but spelt it wrong.
> My value won't be there when elsewhere I refer to the correct attribute:
> "conduction".

Recently there was a big thread where that was raised again (yep, you're not
the first, nor the second, nor the third...).  You should write unittests, use
tools like pychecker, pylint, etc. 

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: data hiding/namespace pollution

2005-10-31 Thread Jorge Godoy
Alex Hunsley <[EMAIL PROTECTED]> writes:

> Btw, can you recall the subject line of the thread? I'd like to google groups
> for it and have a read of that thread...
> ta!

Search for: "alex martelli pychecker" on comp.lang.python...  I don't have the
thread's name anymore.  You'll probably find more than one thread with
that. :-)

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to print random strings

2005-11-02 Thread Jorge Godoy
[EMAIL PROTECTED] writes:

> Im at the end of chapter 3 of "Python Programming For The Absolute
> Beginner, Michael Dawson " and he asks to make a fortune program that
> displays a fortune each time its ran, and to have 5 unique fortunes.
> 
> Whats confusing is that, he never discussed how to do this. The only
> thing he talked about was using random.randrange() and I tried that
> with text but it seems like its only for integers as it complains when
> I put text in the argument.
> 
> So how would I go about have 5 strings, and running a program that will
> randomly pick one of those to print?
> 
> I think he may have forgot to cover something?

How about using the integer as an index to access the elements of a list? ;-) 

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Class Variable Access and Assignment

2005-11-03 Thread Jorge Godoy
"Graham" <[EMAIL PROTECTED]> writes:

> perhaps this was intended, i was just wondering if anyone else had
> noticed it, and if so what form would you consider to be 'proper'
> either referring to class variables via the class itself or via
> instances of that class. Any response would be greatly appreciated.

It was discussed before here and there's something about that at the docs:
http://docs.python.org/tut/node11.html


-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: when and how do you use Self?

2005-11-03 Thread Jorge Godoy
bruno at modulix <[EMAIL PROTECTED]> writes:

> >>Don't use self. Use other.
> > 
> > 
> > Are you serious? 
> 
> Are you seriously wondering if I am serious ?

Hmmm...  I hope there's no deadlock in this loop... 

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Getting Python Accepted in my Organisation

2005-11-04 Thread Jorge Godoy
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

> Alex Martelli wrote:
> > It would still be easier to respond to your posts if you didn't
> > top-post, though (i.e., if you didn't put your comments BEFORE what
> > you're commenting on -- that puts the "conversation" in a weirdly
> > distorted order, unless one give up on quoting what you're commenting
> > on, or invests a lot of time and energy in editing...;-).
> >
> oops. I developed this habit because I found I like to read it this
> way. As I usually would read just the first few lines to see if I want
> to read on. top post serve me well for this purpose. And I assume other
> may also find my stuff not worth reading and skip quick so why force
> them to scroll all the way down ? I would only do in-line response type
> when there is a need for specific response in context.

I'm more of the type that wouldn't read on if I have no context to what I'm
reading...  Specially if there's a mix of top posts with bottom posts... 



-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to present Python's OO feature in design?

2005-11-07 Thread Jorge Godoy
"Ben Sizer" <[EMAIL PROTECTED]> writes:

> I don't know if there are any tools that convert UML to Python code,
> but that doesn't stop you working with UML diagrams if you choose, and

Umbrello helps starting things using as a base UML diagrams.  You'll probably
have to draw your diagrams on it, though...

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyFLTK - an underrated gem for GUI projects

2005-11-07 Thread Jorge Godoy
aum <[EMAIL PROTECTED]> writes:

> What I'm saying is that there are many basic projects being written for
> these toolkits, whose functionality could be completely supported by
> PyFLTK. When only a smaller set of widgets is needed, there's a stronger
> case for using lighter widget libraries - especially FLTK, because you'll
> get way more functionality per line of code, and finish your project
> faster, than if using the bigger toolkits with their application-level red
> tape - the extra lines of code you have to write to get things done.

At least on Linux world, it is easier to find Qt or GTK than FLTK.  Not having
to deploy new base libraries for another project when there are other
available is a big plus, IMHO.  Specially if you have no control over the
politics of updating servers, installing extra software, etc.  And it would
sound really weird asking the admin to install new software on the server or
on workstations to provide a GUI layer for a more complex project just after
using a lighter one...  "Why not using the same stuff for both?" is the
question I hear from them.

Installing things mean, usually:

- checking licenses

- checking vulnerabilities

- convincing admin / IT staff that it is needed and there's no
  "already installed" alternative

- maintenance

- tests on upgrading the environment

- tests on deployment (who knows if there's something that might cause
  a clash or interfere with other apps?)

and a few more stuff.  Doing all that just because one app might use a lighter
toolkit doesn't look interesting.

On the other hand, if the environment requires lighter libs -- the software
will be embedded in something --, then it is fine doing all these because of
that. 

> If travelling off-road for a few weeks and driving over minefields in
> enemy territory, take the Hummer. But for ordinary use, like commuting to
> work, visiting friends, shopping etc, using anything more than the Honda
> 4-cylinder sedan is IMHO a waste of resources.

You can choose only one vehicle and you don't know where you'll be sent.
Which will you pick?

> Similarly, coding something in wx when FLTK will suffice is a waste of
> time, effort, disk space, CPU cycles and memory.

If wx is already there, installing FLTK starts being a waste of resources,
disk space, CPU cycles, memory (it won't be shared with other apps...), etc. 


-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: web interface

2005-11-07 Thread Jorge Godoy
"Ajar" <[EMAIL PROTECTED]> writes:

> I have a stand alone application which does some scientific
> computations. I want to provide a web interface for this app. The app
> is computationally intensive and may take long time for running. Can
> someone suggest me a starting point for me? (like pointers to the
> issues involved in this, or even better any of the existing tools for
> doing this...)

For the long running task you might get some idea from cvsmonitor (Perl
code).  It has a long running task that is updating some repositories and
giving feedback from time to time to the user.

One thing is: detach all what is possible from user interface and give
feedback from time to time to avoid browser timeout and the user thinking the
app hanged.


Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help-I am new to python, I have some query could sombody help me out.

2005-11-07 Thread Jorge Godoy
"sumi" <[EMAIL PROTECTED]> writes:

> I am very new to python ,  I have small query could some one help me.
> every time I get a new load i need to do few things like creating some
> dir, changing some file contents and moving some files , i would like
> to know if i can write a python script to do all these operation .

You can...  Creating directories, processing file contents and moving files is
not hard with Python (if the "processing" part is simple, then it all becomes
easy). :-)

Take a look at the tutorial and the documentation on the website.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and PL/SQL

2005-11-07 Thread Jorge Godoy
Gerhard Häring <[EMAIL PROTECTED]> writes:

> In my not so humble opinion, instead of all this fancy stuff, you will be
> better off writing your stored procedures in PL/SQL, which is a very good
> language for manipulating data, and writing portable, efficient and
> maintainable server-side database code.

And if Python is the requirement, but not Oracle, one can write "stored
procedures" (functions is the name) in Python with PostgreSQL. ;-)

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Map of email origins to Python list

2005-11-07 Thread Jorge Godoy
Claire McLister <[EMAIL PROTECTED]> writes:

>   We've been working with Google Maps, and have created a web service to map
> origins of emails to a group. As a trial, we've developed a map of emails to
> this group at:
> 
>   http://www.zeesource.net/maps/map.do?group=668
> 
>   This represents emails sent to the group since October 27.
> 
>   Would like to hear what you think of it.

H...  I don't see mine listed there: I'm in South America, Brasil.  More
specifically in Curitiba, Paraná, Brasil. :-)  

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Map of email origins to Python list

2005-11-07 Thread Jorge Godoy
"George Sakkis" <[EMAIL PROTECTED]> writes:

> "Jorge Godoy" <[EMAIL PROTECTED]>:
> 
> > H...  I don't see mine listed there: I'm in South America, Brasil.  More
> > specifically in Curitiba, Paraná, Brasil. :-)
> 
> That's funny; I was looking for mine and I stumbled across yours at
> Piscataway, NJ, US. :-)

Phew!  Thanks for finding me.  I was feeling a bit lost... :-)


Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Newbie Alert: Help me store constants pythonically

2005-11-07 Thread Jorge Godoy
"Brendan" <[EMAIL PROTECTED]> writes:

> seems risky.  Also my config files have (a tiny bit of) nested
> structure, such as:
> 
> Model1(
>numBumps = 1
>sizeOfBumps = 2
>transversePlanes = [
> Plane(type=3, z=4),
> Plane(type=5, z=6),
> Plane(type=3, z=8)
> ]
> )
> 
> which I'm not sure the .ini format can easily support.  I could use
> (key buzzword voice) XML, but  I fear that might send me down the
> 'overcomplicating things' path.  Your suggestion has given me some new
> places to search Google (configparser, python config files), so I'll
> look around for better ideas.

Take a look at pickle (specially cPickle) module for pickling and unpickling
data directly from / to Python types.  What you want can be mapped to
dictionaries of lists of dictionaries. :-)

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Zope vs Php

2005-11-17 Thread Jorge Godoy
Mike Meyer <[EMAIL PROTECTED]> writes:

> That said, I have to confess that lately I've been using Cheetah
> templates, because the syntax for inserting values is simpler, and the
> way Cheetah templates work naturally in the Python inheritance
> hierarchy.

KID is also nice and can be used as he wants and in a cleaner way as well. ;-)
It suits both worlds.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Zope vs Php

2005-11-17 Thread Jorge Godoy
Mike Meyer <[EMAIL PROTECTED]> writes:

> Jorge Godoy <[EMAIL PROTECTED]> writes:
> > Mike Meyer <[EMAIL PROTECTED]> writes:
> >> That said, I have to confess that lately I've been using Cheetah
> >> templates, because the syntax for inserting values is simpler, and the
> >> way Cheetah templates work naturally in the Python inheritance
> >> hierarchy.
> > KID is also nice and can be used as he wants and in a cleaner way as well. 
> > ;-)
> 
> Since you didn't provide a URL, and KID is a pretty generic term to
> google for, I'll just ask:

Sorry.  http://kid.lesscode.org/

> One of the things I really like about Cheetah - at least compared to
> other templating systems I've looked at - is that it's fully
> cooperative with the Python inheritance sydstem. A cheetah template
> can inherit from a python class, or a cheetah template, and a Python
> class can inherit from a cheetah template. This brings the full power
> of OO programming facilities to the templating system, and is simply
> blows away other templating systems, or trying to build that kind of
> flexibilty using "pure python". Does KID have have that kind of
> facility?

I am beginning with it, but it does have it.  You can "extend" from templates
and use classes and methods inside your code as well.  I'm using Kid with
Apache (mod_python) and with CherryPy.

> While I'm at it - how does KID do for things that aren't HTML?
> Cheetah integrates with web servers, but can be used to generate
> nearly anything. I've found that using Cheetah scripts to build
> Makefiles that run Cheetah scripts to build a dynamically determinedj
> set of pages to be pretty handy.

Kid is for XML output.  It won't work with non-HTML output... 

> And finally - got a URL?

http://kid.lesscode.org/  ;-)


Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Zope vs Php

2005-11-18 Thread Jorge Godoy
Mike Meyer <[EMAIL PROTECTED]> writes:

> Unfortunately, my tools don't - which is another one of the things I
> like about Cheetah: it doesn't interfere with my X/HTML tools. For
> instance, I edit attributes by asking the editor to let me edit the
> current tags attributes. It opens window with a list of valid
> attributes, along with type information about those attributes. I edit
> the list, close the window, and it inserts the required attributes,
> appropriately quoted, into the tag. I couldn't use that for py:*
> attributes without tweaking the DTD for each language I wanted to
> edit. Similar problems crop up with the other features that depend on
> information from the DTD.

What DTD do you use to write Python code?  ;-)

I can use my "HTML writing tool" with the XHTML, HTML, etc. DTD specified and
have it insert the tags for me.  The Python namespace allows me to insert
Python commands and still have valid (X)HTML output (at least tidy is very
happy with them).  After I have the mockup, with Python tags embedded, I send
the files to the webdesigners and they do their art. :-)

For one project we are using a lot of CSS and JavaScript.

But, as you can see with TurboGears, it's possible to do even more with it.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython Licence vs GPL

2005-11-24 Thread Jorge Godoy
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

> I meant the SCO saga, don't know if you are referring the same thing.

Probably.  MS bought some shares from SCO to help financing the lawsuit. 

Anyway, I don't see much people worrying about it and in fact, I see more
people laughing about SCO's mistakes and wrong information / facts... 

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Hello World-ish

2005-11-26 Thread Jorge Godoy
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

> from os import *
> print "Working path: %s" % os.getcwd();
> 
> Just wondering how you would do that .. in theory, if you get what I
> mean?
> I get
> NameError: name 'os' is not defined
> currently, which I don't know how to fix.. anyone?

Either:

import os

or

print "Working path: %s" % getcwd();



Avoid "from  import *" always when you can (there are still modules
designed to work with it).  It pollutes namespace and might lead to
undesirable clobbing of data structures (is it your 'getId' method or the
module's that is being used? ;-)).



Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Eclipse best/good or bad IDE for Python?

2005-12-01 Thread Jorge Godoy
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

> I'm trying to move beyond Emacs/Vim/Kate
> and was wondering if Eclipse is better and if it is the *best*
> IDE for Python.
> 
> Should I leave Emacs and do Python coding in Eclipse?

IMVVVHO, Eclipse is like a "graphical" Emacs.  It uses a lot more memory,
demands an structure that makes you put your projects under its structure
instead of using any layout that you wish.  Integrating it with Subversion,
CVS or other VCS is as hard as with Emacs -- if not harder for some VCS...

But, it is just me and I use Emacs for something like 7 years now... ;-)

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scientific Notation

2005-12-03 Thread Jorge Godoy
"Dustan" <[EMAIL PROTECTED]> writes:

> No, I mean given a big number, such as
> 1000, convert it into
> scientific notation.

It's the same.

>>> print "%e" % 1000
1.00e+51


-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Ten Essential Development Practices

2005-07-29 Thread Jorge Godoy
Michael Hoffman wrote:

> He spends so much space on "Create Consistent Command-Line Interfaces,"
> a section that, in Python, could be replaced with a simple "Use optparse."

In Perl there's also the equivalent of optparse, but where does it guarantee
that you'll use consistent name options and design a good interface?  I
think he's point is much broader than parsing input from the command line.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Wheel-reinvention with Python (was: Ten Essential Development Practices)

2005-07-29 Thread Jorge Godoy
Jeremy Moles wrote:

> Four?
> 
> 1. wx
> 2. PyGTK
> 3. Tk (Are you including this one even?)
> 4. ???

PyQt / PyKDE.

> Of the few I can think of, only one would qualify as great. :)

The fourth one? ;-)

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Ten Essential Development Practices

2005-07-29 Thread Jorge Godoy
Michael Hoffman wrote:

> True, but a lot of his point *is* parsing input from the command line.
> Consider the following points paraphrased from his article:
> 
> * Don't mix multiple ways of specifying options. (Solved by optparse)
> * If a flag expects an associated value, allow an optional = between the
> flag and the value. (Solved by optparse)
> * Allow single-letter options to be "bundled" after a single dash.
> (Solved by optparse)
> * Always allow -- as a file list marker. (Solved by optparse)
> 
> And a lot of the other points are things that are made much, much,
> simpler by optparse, to the point that they become somewhat obvious.

Take a look at the Perl module, then.  You'll see that all of these are also
solved there "automagically".  I've stoped coding Perl almost 3 years ago,
and even then I never had to write anything to parse command line input by
hand.

I suggest you take a look at Getopt::Long, at CPAN. 

http://search.cpan.org/~jv/Getopt-Long-2.34/
http://search.cpan.org/src/JV/Getopt-Long-2.34/README


Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: ANN: PyDev 0.9.7 released

2005-07-29 Thread Jorge Godoy
Rocky Burt wrote:

> Installing fresh PyDev 0.9.7 onto eclipse 3.1 (no prior PyDev installed)
> yields the following error when opening a python file.  Seems like a
> simple enough error... the PyEdit class seems to be present.

I had the same problems today.  Then I read the requisites: Java 1.5.0. ;-) 
Installing it made everything work perfectly.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Ten Essential Development Practices

2005-07-29 Thread Jorge Godoy
Michael Hoffman wrote:

> In that case, I think he just wasted a lot of time in the article, and
> would have been better off saying "use Getopt::Long."

This is why I think he was more concerned with design than implementation. 

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: The state of OO wrappers on top of wxPython (was Re: Wheel-reinvention with Python)

2005-07-30 Thread Jorge Godoy
Ed Leafe wrote:

>  There are also several classes in wxPython that Dabo has not wrapped,
> primarily the lower-level drawing classes and some of the newer graphics
> classes, mainly because they weren't needed for a database application
> framework. However, if there's a need, we'll be glad to add it.

If it is added, let us know.  I can't think of a better way to visualize
database reports in an easy and fast way.  Specially for BI. 

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: The state of OO wrappers on top of wxPython (was Re: Wheel-reinvention with Python)

2005-07-30 Thread Jorge Godoy
Ed Leafe wrote:

> On Saturday 30 July 2005 16:06, Jorge Godoy wrote:
> 
>> If it is added, let us know.  I can't think of a better way to visualize
>> database reports in an easy and fast way.  Specially for BI.
> 
>  What specifically are you looking for? We are working on the report
>  writing engine now, tying in ReportLab.

Bar and line graphics, mainly.  In an easy and portable way.  Something that
calculates the axis scales automatically, that allows users to change some
information, add legends, put values in specific points and all those
things that are common to business graphs. 

I know it is a lot complex, specially due to user interaction, but it is
doable.  I have some ideas and I'll be implementing them with PyQt for some
projects, but they aren't my first priority now.


-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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

Re: The state of OO wrappers on top of wxPython (was Re: Wheel-reinvention with Python)

2005-07-30 Thread Jorge Godoy
Ed Leafe wrote:
 
>  I'll defer this to my partner, Paul McNett. He's spearheading the
>  reporting
> module for Dabo, and may know of some tools that are already out there
> that could generate the image, which Dabo could then display.

There are some out there.  There's one implementation that is compatible
with Matlab and is also compatible with wxPython.  Take a look at
matplotlib: http://matplotlib.sourceforge.net/ 

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Wheel-reinvention with Python

2005-07-31 Thread Jorge Godoy
Mike Meyer wrote:

[ Having GUI stuff included on a standard installation of Python ]

> However, you can get compilers for both that come bundled with a good
> GUI library. Could it be that that's what you really want - someone to
> distribute Python bundled with an enterprise-class GUI library and
> IDE?

And then you are going to have three or four different distributors of
Python using three or four different GUI toolkits and also python.org
distributing Python for free without any (or with TKinter)...  Which one
will be the "standard" distributor so that it gets documented and adopted?

In an international project I see othe problems as well -- cost, logistics,
S&H, customs, etc. 

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Wheel-reinvention with Python

2005-07-31 Thread Jorge Godoy
Mike Meyer wrote:

> We already have multiple distributions of Python: CPython, IronPython,
> and Jython (and there's at least one more). We even have multiple
> distributions of CPython, what with Active State doing their own and
> the MacPython distribution. I'm not proposing a fundamental change in
> the world, I'm suggesting an addition that would satisify the OPs
> needs.
> 
> The "standard" distributor is whichever one your organization settles
> on when it comes time to choose a Python distribution.

So we don't solve the problem with a "standard" distribution and that was
the point I was trying to show.

In fact this sounds more like a joke I've heard a while ago: standards, if
you don't like the ones out there, create your own.

> None of which has stopped linux from following this path.

And solve a completely different problem while sharing the very same problem
you, on the post prior to mine, was trying to solve: what is the standard
GUI on a Linux distribution?  QVWM?  WindowMaker?  Gnome?  KDE?  FVWM?

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Wheel-reinvention with Python

2005-07-31 Thread Jorge Godoy
Cliff Wells wrote:


> Well, I think this exposes one of the more interesting sides of open
> source software in general.  For better or worse, you get choices.  If
> you don't like choice, you won't like open source.  Many choices is
> sometimes great, sometimes annoying, but the bottom line is that very
> little is spoon-fed to you, and choice and flexibility are the primary
> reasons most people choose open source (this was the overwhelming
> verdict of a survey SuSE took a while ago).  You can't even *run* Linux
> without making a few basic choices (Which distro? Which architecture?
> Which GUI? etc).  If you really expect this to change then I expect
> there are many frustrating days ahead for you.  I think most end users
> of Linux wish that the GNOME and KDE teams would merge (and there would
> be a great benefit, I expect, in reduced duplication of effort), but
> quite frankly, it ain't gonna happen, and quite probably there would be
> a lot of downsides to such an event as well.

I agree with you.  And having choices is what is good, specially because
there is no single solution for all problems.

And I find it great to have this freedom to choose specially because not
everybody share the same aesthetics idea.  What some people find beautiful
I don't like and vice-versa.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Wheel-reinvention with Python

2005-07-31 Thread Jorge Godoy
Paul Rubin wrote:

> I can put up a Tk gui in about 5 lines of code from a stock Python
> distro without having to install anything additional.  How do I do
> that with wxPython?

You can try it here, without installing the package python-tk.  And since
you need to install python-tk, there's no problem at all installing package
wxPython to achieve the same.  Or kdebindings-python and using pyQt.  Or
installing another RPM package -- using Apt, so you don't have to worry
about dependencies -- with a different toolkit.

I've seen SuSE, Mandriva and Conectiva with separate packages for TKinter. 
I believe there are more.  Unless, of course, you're first installing a
personalized Python -- and loosing this "advantage". 

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Jorge Godoy
Ed Leafe wrote:

>  Should we have defensive code for every possible broken installation? We
>  use
> a lot of the Python standard library modules, many dbapi-compliant
> modules, and, of course, wxPython. If someone mis-installs one of the
> pre-requisites, do you expect Dabo to catch that and present you with a
> diagnostic message? I'm serious here: I want to know what people consider
> acceptable for a software package that relies on other packages.

If it doesn't interfere with my other custom options, catching unsatisfied
requisites is interesting.

But a helpful stack trace is enough for the developer.  Just be sure to say
that it was "this" or "that" requisite that generated the problem and
that's it.  Giving some references on how to fix the problem is a plus.

But if you're going to check everything, you'll end up checking the whole
system at each and every run -- because I might have added / removed
packages since I installed Dabo -- what would give a big performance
penalty.  

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Jorge Godoy
Daniel Dittmar wrote:

> To be fair to those slothes: some of them want to write software for a
> commercial setting where they have to install it on other peoples
> machines. So it isn't just getting it to work one one own's machine.
> Using a specifc Python library with external dependencies means also
> installing and *supporting* it on a possible large set of configurations.

I see no problem with that.  Specially since there are lots of ways to share
directories on a network installation.  You install it once and it's done.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Jorge Godoy
Daniel Dittmar wrote:

>> I see no problem with that.  Specially since there are lots of ways to
>> share
>> directories on a network installation.  You install it once and it's
>> done.
>> 
> 
> Some on Windows, some on one Linux, some on another Linux with a newer
> GTK, some want it on their laptops to work on the road ...

All of the fixed and network accessible are easily solvable (? Is it correct
English?).  Corporative environments should also have an upgrade policy, so
the "new GTK" would just exist after testing has been done and this "new
GTK" is certified for the company's apps.  

For laptops to work on the road there are two options: VPNs and installing
it locally.  How many "laptops to work on the road" there will be compared
to "fixed workstations"?

We can find several problems, almost all of them can be solved with the
admin's creativity.  

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Jorge Godoy
Cliff Wells wrote:

> On Mon, 2005-08-01 at 13:28 -0300, Jorge Godoy wrote:
>> 
>> We can find several problems, almost all of them can be solved with the
>> admin's creativity.
> 
>>>> import creativity
> Traceback (most recent call last):
>   File "", line 1, in ?
> ImportError: No module named creativity
>>>>
> 
> Nope.  Not included with Python.  Can't be used.

You haven't installed the package 'admin'. ;-)  

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Dabo in 30 seconds?

2005-08-01 Thread Jorge Godoy
Daniel Dittmar wrote:

> Jorge Godoy wrote:
>> We can find several problems, almost all of them can be solved with the
>> admin's creativity.
> 
> You must distinguish between solving technical problems once a course
> has ben set and choosing such a course in the first place.
> 
> The latter has to deal also with the risks of the unknown. Of course
> what is unknown can be influenced somewhat by getting information.

I agree where you say that lack of information is a risk.  But I don't see
how it -- lack of information -- wouldn't affect both scenarios.  At least,
when I'm developing a solution, I have to present a deployment plan and
cover the specified cases.  If something was not specified or is an
exception, then a new action plan is developed and the client is consulted
again (after all, if it's his fault there will be extra costs for him; if
it's my mistake, then I'll assume the costs). 

This repeats until all the needs are documented and the code works on them,
or exceptions where the code won't work are also documented.  Always
there's the "OK" from the client.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Wheel-reinvention with Python

2005-08-01 Thread Jorge Godoy
Mike Meyer wrote:

> Exactly what problem are you trying to solve? If it's the one about
> not having a standard GUI, I don't think it's a problem.

Me neither.  You pointed out that having a standard distribution made by
some company would solve the non-standard GUI problem.  I believe we share
the same opinion, judging from this last post of yours.  Maybe I missed
something on your message and read it as if you had a different opinion.
 
>> In fact this sounds more like a joke I've heard a while ago: standards,
>> if you don't like the ones out there, create your own.
> 
> Works for me.

What works for you?  You believe that chaos is better than having standards? 
I believe that flexibility is good, but not chaos.
 
> I think you have me confused with someone else. I was responding to
> someone who was claiming that the lack of a standard enterprise
> strength GUI toolkit was a serious problem for Python - I disagree. I

I dunno.  Maybe I confused your words.  I agree on disagreeing ;-)

> won't recap the thread, but other languages have been *very*
> successful without having a GUI as part of the language, all they had
> was one development environment distributed with a GUI.

One IDE, you mean?  I believe the freedom to choose from multiple IDEs is
also good.  Some code on VI, others on Emacs, others on Eclipse, others
on ... 

I agree that having multiple toolkits is good.

> BTW, in answer to your rhetorical question about GUI's for Linux, the
> answer is plwm.

:-)

And does it integrate well with common business apps, such as a mail client,
note taking apps, addressbooks (with personal and shared entries), calendar
with ability to share appointments, etc.?


Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Dabo in 30 seconds?

2005-08-02 Thread Jorge Godoy
Daniel Dittmar wrote:

> Because you put different probabilities on different outcomes. One easy
> 'risk markup' would be to assume that parts of the standard Python
> distribution like TkInter have a higher chance of working with the next
> release than external libraries like wxPython. Of course, there are lots

I think it will be true only if there's no package for the considered
toolkit on my Linux distribution, *BSD, Windows or Mac.  I don't see it as
a risk because having the toolkit available on the destination platform is
a pre-requisite and comes before coding.

If I already have the code working on some version, backwards compatibility
handles a little of the problem and besides, I can create one new package
for the lacking environment.  I just need to do this work once.

> of other possible criteria:
> - which has been under more active development in the last releases
> - which source code is easier to understand so that I don't have to rely
> on external help

- Which takes less time
- Which needs less hand written code
- Which provides more functionality
- Which has data aware controls
- ...

There are lots of other things that are considered, independently of the
toolkit.  None gets a "100% OK" grade, and some things have a higher weight
to me or to the client.


-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


PyQt: Problem finding and showing a record in a QDataBrowser

2005-08-08 Thread Jorge Godoy
[I've also posted this to pyqt-pykde list, but I haven't got any answers so
far.  I also thought that someone here might have solved it or have a
different idea to help me :-) Sorry for those that read it twice. ]


Hi.


I have created an interface where I have a QDataBrowser and all of its
editing and navigating controls and one of the displayed controls is in a
QSpinBox.

I have the navigation from current to next and previous records working fine
if I only use the data browser controls.  I also can recover the correct
record if I type in a valid code at the spin box.

For the spin box to work, I'm doing this:


def codAmostra_valueChanged(self, amostra_id):
cursor = self.dbAmostras.sqlCursor()
cursor.select('amostra_id=%s' % amostra_id)
self.dbAmostras.first()
self.dbAmostras.refresh()


(codAmostra is my spinbox, dbAmostras is my QDataBrowser -- just as a
curiosity, "amostra" is the pt_BR for "sample")

I was willing to use "self.dbAmostras.seek()", but it requires that I know
the exact position of the record -- using it I wouldn't need to filter my
data and I think the problem would be solved... -- but I don't know it. 

There can be "holes" in my sequence (otherwise I'd use only the spinbox) and
I'll be having a few million entries (what makes it impossible to go
through each and every record every time I change the value at the spinbox
manually).

I was reading Qt3 docs trying to find out some other mean to recover the
record I need without messing with the filter because if I use the filter,
then I can't paginate through all records anymore.

Any hints on an alternative approach that would allow me to use both
controls?


* Python 2.4
* SIP 4.1.1 (4.1.1-255)
* >>> qt.qVersion()
  '3.3.4'
  >>>


Thanks in advance,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Oreilly CodeZoo

2005-08-08 Thread Jorge Godoy
richard wrote:

> We (PyPI / Cheese Shop developers) are talking to the CodeZoo people about
> the relationship between the two systems. Things PyPI has:
> 
> 1. python setup.py register
> 2. python setup.py (sdist|bdist|bdist_egg|bdist_wininst|...) upload
> 3. http://cheeseshop.python.org/
> 4. better categorisation (IMO)
> 5. XML-RPC interface
> 6. 852 packages registered

Richard,


Some feedback:


With regards to 6, it would be interesting, though, to separate the
classification using just the software name and not the version.  For
example http://cheeseshop.python.org/pypi?:action=browse&asdf=256 has four
entries to ZODB3, in four different versions.  This would decrease the
amount of packages registered, but would allow a more realistic view of
"packages" and not of "package versions", IMVHO.

A subtree with version numbers could solve the problem of storing
information for old versions when a new one is added.

With regards to 4, I'd like to see the "Topic" category in the beginning of
the page -- this is what most people search, I guess -- and not at the
bottom of it.  I'm usually looking for a software to do  and not
a software that is being planned, is in alpha - beta - production stage,
etc.  

Also, there's a discrepancy on the amount of packages stored.  The
categorization page says there are 679 packages.  The main page says there
are 852.  I believe the categorization page does what I suggested and
disregard different versions of the same software.  I think this (679) is
the correct number.

Ah!  And an RSS feeder would be interesting, to know when there are new
packages or when a package has been upgraded... ;-)  Where's the
"wishlist"? :-)

I hope you see this as a constructive feedback from someone that has just
screened the pages, getting to know it. 


Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Recommendations for CVS systems

2005-08-09 Thread Jorge Godoy
[EMAIL PROTECTED] wrote:

> The IDE what have been using/experimenting with are drPython and
> eclipse with PyDev.

Eclipse has a fine integration with both CVS and Subversion.  If you'll be
having a lot of images and binary objects or you don't have the design
right by the time you start coding, I'd recommend on using Subversion.  If
you do, both are good.

Why Subversion?  Because you'll be able to move files around without loosing
their history or without loosing the old filename in the repository.

One dawback is that you'll have to install the Subclipse plugin to use
Subversion, while CVS is already there...  But it's as easy as pointing a
new update/install site and clicking on the desired package.

We use both here and recently we've migrated to Subversion as our main VCS. 
We noticed that there was a reduction in disk space that can be very
significative depending on the type of file that you'll be working with.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: PyQt: Problem finding and showing a record in a QDataBrowser

2005-08-09 Thread Jorge Godoy
Jorge Godoy wrote:

> I have created an interface where I have a QDataBrowser and all of its
> editing and navigating controls and one of the displayed controls is in a
> QSpinBox.
> 
> I have the navigation from current to next and previous records working
> fine if I only use the data browser controls.  I also can recover the
> correct record if I type in a valid code at the spin box.

Just to make the answer available to other that might have the same problem,
I had to deactivate the framework code and handle the cursor from the
databrowser manually.

It also fixed a performance problem since I only have one record fetched and
not all of them.  This makes the answer time linear (database dependant, of
course) no matter how many records I have on the database.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Oreilly CodeZoo

2005-08-09 Thread Jorge Godoy
richard wrote:

> That's a good idea. Unfortunately, changing the sorting of the classifiers
> will be fun. Could I ask you to submit an RFE "bug" via the link on the
> pypi page?

I'll do that tomorrow morning.

> Yep, this is related to your other comment regarding my 6th point. Also, I
> don't believe packages are included in the browse if they have no
> classifiers.

It means that some packages might be "lost" somewhere?  How about an
"unclassified" classifier? :-)

> There's a top-level RSS feed, but not one per-package.

I was thinking about one per topic / classification, not per package.  It
would be overkill to subscribe to 600+ feeds.


Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Moinmoin config

2005-08-17 Thread Jorge Godoy
Mark wrote:

> Hi,
> 
> I have Moinmoin 1.3.4 installed and working on Linux RHEL3.0.  However,
> all screen elements are lined up on the left hand side.   How can I get
> it displayed like the wiki at:


Mark,


Mine looks like yours when I have problems with some Apache process.  I
haven't tracked the problem down yet, but it works perfectly with 2.0.53,
but it doesn't work with Apache 2.0.54 on a SuSE 9.3 Professional box.

I have the following packages installed:

apache2-2.0.53-9.2
apache2-doc-2.0.53-9
apache2-example-pages-2.0.53-9
apache2-mod_perl-2.0.0-4
apache2-mod_php4-4.3.10-14.6
apache2-mod_python-3.1.3-42
apache2-mod_ruby-1.2.4-3
apache2-prefork-2.0.53-9.2

I hope it helps.


Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: RE Question

2005-08-18 Thread Jorge Godoy
Yoav wrote:

> I don't understand why the two REs produce a different result. I read
> the RE guide but still I can't seem to figure it out.
> 
>  >>> t
> 'echo user=name password=pass path="/ret files"\r\n'
>  >>> re.findall(r'(?<=\s)[^=]+=((?:".*")|(?:\S*))(?=\s)', t)
> ['name', 'pass', '"/ret files"']
>  >>> re.findall(r'(?<=\s)[^=]+=((".*")|(\S*))(?=\s)', t)
> [('name', '', 'name'), ('pass', '', 'pass'), ('"/ret files"', '"/ret
> files"', '')]

Hi Yoav.

You can see at "sre" documentation (use that instead of the docs for "re")
that using "?:" you're asking for a non-groupping version of the
parenthesis match.  When you use parenthesis, the matched expression is
saved for using later.  Using "?:" you prevent that.  This is what causes
the difference for you.

> Also, does '|' char (meaning or) produces a pair for each section. I
> don't understand how it works. Can someone please direct me to a place
> which will explain it?

I didn't get your second question.  When you use "|" the first match is
used.  It is a short-circuited version of "or".  I mean, it tries the first
regexp, if it matches, the second expression is ignored.  The same is true
for "and", except that the comparisons end on the first false result. 


Be seeing you,
-- 
Jorge Godoy  <[EMAIL PROTECTED]>

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


Re: Newbie - instanciating classes from other files

2005-09-14 Thread Jorge Godoy
[EMAIL PROTECTED] writes:

> Hey guys, i just started learning python (i usually use java/C).
> 
> this has got me stumped as its not mentioned in the documentation
> (unless im skimming it every time).
> 
> How does one instanciate a class from another file
> 
> i thought it would be
> ---code---
> import file.py
> 
> thisFile = ClassName()
> ---not code---

import file# see that there's no ".py"
thisFile = file.ClassName()

or


from file import ClassName
thisFile = ClassName()


This is in the docs.

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Django Vs Rails

2005-09-15 Thread Jorge Godoy
Jacob Smullyan <[EMAIL PROTECTED]> writes:

> I have mixed feelings about automagical schema introspection.  PyDO
> supports it, and will probably do so increasingly robustly if people
> use it.  But part of me feels that "explicit is better than implicit"
> may win out over DRY here, because the ORM layer and the db layer
> exist in different realms, and if the ORM layer adapts silently to
> changes in the db layer, other code is likely to fail in unpredictable
> ways, including silently, whereas an explicit declaration of what
> fields are in a table, for instance, will fail with a hard error.  But
> maybe this is anal retentiveness, akin to a need for strong typing.

I just wonder when it becomes bad having to declare everything.  For example,
we have databases with 600 tables.  Declaring them all again will make a huge
PITA and would not be very helpful, specially because there's already some
declarations at the ER diagrams, at the SQL script, inside the database, and
then again at each and every python class? 

Having the introspection is great in this case (even though it is boring
having to declare all those classes and tell them to fetch their structure
from the database it is better than having to "recreate" all of them).

With regards to failures, this is one of the reasons for unit tests :-)  They
can help finding out where is the problem and they should never fail
silently. 

-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   5   >