how to build with --enable-shared so that binary knows where libraries are.

2010-03-31 Thread d d
The following is on Linux.

I'd like to build python with ./configure --enable-shared.  And
install in a non-standard place (an nfs-mounted directory).

However, the binary is then not usable, since it can't find the
library.  I can fix this by defining LD_LIBRARY_PATH, but I don't want
to do that.  Doing anything system-specific is impractical, since many
systems will point to this directory (LD_LIBRARY_PATH is feasible,
though undesired, because it can be set in a common script that users
call from their .cshrc files.)

Is there a way to configure the build such that the binary will know
where the shared library is?

I found this:
http://koansys.com/tech/building-python-with-enable-shared-in-non-standard-location
It recommends LDFLAGS="-rpath ", and mentions that you
get a "compiler cannot create executables" error unless you first
create the empty directory.  But I get that error even when I do
create the empty directory.

Any help would be appreciated.

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


Re: how to build with --enable-shared so that binary knows where libraries are.

2010-03-31 Thread d d
d d  gmail.com> writes:

> I found this:
>
http://koansys.com/tech/building-python-with-enable-shared-in-non-standard-location
> It recommends LDFLAGS="-rpath ", and mentions that you
> get a "compiler cannot create executables" error unless you first
> create the empty directory.  But I get that error even when I do
> create the empty directory.

I typed -W1 instead of -Wl.  Works now. :-)

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


Editing File

2006-07-12 Thread D
Hi, I currently have a Python app with a Tkinter GUI frontend that I
use for system administration.  Everytime it launches, it reads a text
file which contains info about each host I wish to monitor - each field
(such as IP, hostname, etc.) is delimited by !!.  Now, I want to be
able to edit host information from within the GUI - what would  be the
best way to go about this?  Basically I just need to either edit the
original host line, or write a new host line and delete the
original..thanks!

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


Re: Editing File

2006-07-12 Thread D
Thanks, guys.  So overall, would it just be easier (and not too rigged)
if any changes were made by just editing the text file?  I want to do
this project the right way, but if it's going to be a big pain to
implement the edit function, just modifying the text file directly
isn't that big of a deal..

[EMAIL PROTECTED] wrote:
> D wrote:
> > Hi, I currently have a Python app with a Tkinter GUI frontend that I
> > use for system administration.  Everytime it launches, it reads a text
> > file which contains info about each host I wish to monitor - each field
> > (such as IP, hostname, etc.) is delimited by !!.  Now, I want to be
> > able to edit host information from within the GUI - what would  be the
> > best way to go about this?  Basically I just need to either edit the
> > original host line, or write a new host line and delete the
> > original..thanks!
>
> Might be overkill - but pickle the  data memeber that contains the
> information.  If you use text instead of binary pickling it should
> still be editable by hand.  for a single line of text it may be a bit
> much - but it's still probably quicker than opening a file, parsing
> etc.

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


Re: Editing File

2006-07-12 Thread D
Thanks to all for the suggestions - I am going to give them a try this
afternoon.  I am still fairly new to Python, so this will definitely be
a good learning experience. :)

Maric Michaud wrote:
> Le mercredi 12 juillet 2006 17:00, D a écrit :
> > Thanks, guys.  So overall, would it just be easier (and not too rigged)
> > if any changes were made by just editing the text file?  I want to do
> > this project the right way, but if it's going to be a big pain to
> > implement the edit function, just modifying the text file directly
> > isn't that big of a deal..
>
> If you don't want to rely on third party libraries, and want a human-readable
> format I'll suggest using csv file format :
>
> and this way ?
>
> In [47]: class Z(object) :
>: def __init__(self, val) : self.val = val
>:
>:
>
> In [48]: lst = [Z(i) for i in range(2) + [ str(e) for e in range(2) ] ]
>
> In [49]: [ (e, e.val) for e in lst ]
> Out[49]:
> [(<__main__.Z object at 0xa76c252c>, 0),
>  (<__main__.Z object at 0xa76c27ac>, 1),
>  (<__main__.Z object at 0xa76c23ac>, '0'),
>  (<__main__.Z object at 0xa76c23ec>, '1')]
>
> In [51]: csv.writer(file('config.csv', 'w')).writerows([
> (type(i.val).__name__, i.val) for i in lst])
>
> In [52]: print file('config.csv').read()
> int,0
> int,1
> str,0
> str,1
>
>
> In [53]: l = [ Z(eval(class_)(val)) for class_, val in
> csv.reader(file('config.csv')) ]
>
> In [54]: [ (e, e.val) for e in l ]
> Out[54]:
> [(<__main__.Z object at 0xa76c218c>, 0),
>  (<__main__.Z object at 0xa76c260c>, 1),
>  (<__main__.Z object at 0xa76c256c>, '0'),
>  (<__main__.Z object at 0xa76c25cc>, '1')]
>
>
>
>
> --
> _
>
> Maric Michaud
> _
>
> Aristote - www.aristote.info
> 3 place des tapis
> 69004 Lyon
> Tel: +33 426 880 097

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


Installing a Windows Printer

2006-08-07 Thread D
I would like to create a script for Windows 2000 that will create a
Standard TCP/IP printer port and install a printer (I have the
applicable printer drivers needed for the install on a network share).
My plan is to use py2exe and distribute (also via network share) the
script so that administrators, or even users, can easily install the
printer.  Is this possible?  If so, I would appreciate it if someone
could steer me in the right direction in terms of how to begin (i.e.
libraries needed, sample code).  Thanks!

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


Job Jar

2006-08-22 Thread D
Hello, I apologize in advance for the vague description, but as of now
I only have an idea of what I'd like to do, and need some guidance as
to if it is feasible, and where to begin.  Basically, I'd like to
create a web-based "job jar", that users in my office can access in
order to view, and "take ownership" of, misc. office tasks.  One idea I
had was that when users select a task (i.e. by selecting a check box
and clicking an UPDATE button), tasks are automatically put in an In
Progress list (which identifies the task and the user who took
ownership of it) - then, when the action is complete, the user updates
it again which puts it in a Completed list (again, with the task
description and the user who completed it).  However, only certain
users should be able to add and modify task descriptions.

Is this something that would be extremely lengthy to write in Python,
or are there applications already out there that would make more sense
to use (I've played around with Twiki, but believe it to be overkill).
If it makes sense to design it from scratch, where can I begin in terms
of which libraries to use, etc.? Thanks in advance.

Steve

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


Re: Job Jar

2006-08-22 Thread D
Thanks, Fredrik - but could I adapt them so that, instead of using them
for bug tracking (don't need version control, etc.), they're just used
for keeping track of simple tasks?

Fredrik Lundh wrote:
> D wrote:
>
> > Hello, I apologize in advance for the vague description, but as of now
> > I only have an idea of what I'd like to do, and need some guidance as
> > to if it is feasible, and where to begin.  Basically, I'd like to
> > create a web-based "job jar", that users in my office can access in
> > order to view, and "take ownership" of, misc. office tasks.  One idea I
> > had was that when users select a task (i.e. by selecting a check box
> > and clicking an UPDATE button), tasks are automatically put in an In
> > Progress list (which identifies the task and the user who took
> > ownership of it) - then, when the action is complete, the user updates
> > it again which puts it in a Completed list (again, with the task
> > description and the user who completed it).  However, only certain
> > users should be able to add and modify task descriptions.
>
> why not use an issue tracker?
>
>  http://roundup.sourceforge.net/
>  http://trac.edgewall.org/
>  https://launchpad.net/
> 
> (etc)
> 
> 

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


Starting New Process

2006-06-01 Thread D
Hello, I need to write a server program that performs the following
tasks:

1)  Listens on TCP port  for a connection
2)  When client connects, launches application (for example, vi), then
closes connection with client
3)  Goes back to listening on TCP port  for an incoming connection

The main thing I need to make sure of is that when the server program
closes, that the applications that were launched remain running (i.e. I
would need to launch them independently of the server program).   Any
help as to how to do this would be greatly appreciated!

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


Re: Starting New Process

2006-06-01 Thread D
Thanks, Jean-Paul - is there any way to do it without using Twisted,
since I am not very familiar with it? (i.e. just using the os library)
Thanks.

Jean-Paul Calderone wrote:
> On 1 Jun 2006 07:34:23 -0700, D <[EMAIL PROTECTED]> wrote:
> >Hello, I need to write a server program that performs the following
> >tasks:
> >
> >1)  Listens on TCP port  for a connection
> >2)  When client connects, launches application (for example, vi), then
> >closes connection with client
> >3)  Goes back to listening on TCP port  for an incoming connection
>
> Untested:
>
>   from twisted.internet import protocol, reactor
>
>   class ViRunner(protocol.Protocol):
>   def connectionMade(self):
>   reactor.spawnProcess(
>   None,
>   '/usr/bin/setsid',
>   ['setsid', '/usr/bin/vi'])
>   self.transport.loseConnection()
>
>   f = protocol.ServerFactory()
>   f.protocol = ViRunner
>   reactor.listenTCP(, f)
>   reactor.run()
> 
> Jean-Paul

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


Re: Starting New Process

2006-06-01 Thread D
Sorry, I should've specified - I'm familiar with sockets, but I was
referring to spawning a 'vi' process independent of my Python app..


Carl wrote:
> D wrote:
>
> > Thanks, Jean-Paul - is there any way to do it without using Twisted,
> > since I am not very familiar with it? (i.e. just using the os library)
> > Thanks.
> >
> > Jean-Paul Calderone wrote:
> >> On 1 Jun 2006 07:34:23 -0700, D <[EMAIL PROTECTED]> wrote:
> >> >Hello, I need to write a server program that performs the following
> >> >tasks:
> >> >
> >> >1)  Listens on TCP port  for a connection
> >> >2)  When client connects, launches application (for example, vi), then
> >> >closes connection with client
> >> >3)  Goes back to listening on TCP port  for an incoming connection
> >>
> >> Untested:
> >>
> >>   from twisted.internet import protocol, reactor
> >>
> >>   class ViRunner(protocol.Protocol):
> >>   def connectionMade(self):
> >>   reactor.spawnProcess(
> >>   None,
> >>   '/usr/bin/setsid',
> >>   ['setsid', '/usr/bin/vi'])
> >>   self.transport.loseConnection()
> >>
> >>   f = protocol.ServerFactory()
> >>   f.protocol = ViRunner
> >>   reactor.listenTCP(, f)
> >>   reactor.run()
> >>
> >> Jean-Paul
>
> Use import socket ifyou don't want to use twisted (which is incredibly
> good). Google for "+socket +python +server" and you will find what you are
> looking for.
>
> See, for example,
> http://floppsie.comp.glam.ac.uk/Glamorgan/gaius/wireless/5.html
> 
> Carl

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


Re: Starting New Process

2006-06-05 Thread D
Sorry to bring it back up, but is there a way to spawn the process
without Twisted?

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


Automate Web Configuration

2006-09-07 Thread D
I would like to write a program that will automate the configuation of
a firewall or router via HTTPS.  So, I need to import the applicable
certificate, and be able to configure the unit as if I was
typing/selecting the appropriate fields manually using a web browser.
If there is a command-line based tool that would allow me to do this, I
would be more than willing to give it a try.  Otherwise, is there a
Python library that would do the same?  Thanks.

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


Re: Socket Programming - Question

2006-02-10 Thread D
Thanks!  Now, I'm a bit confused as to exactly how it works - will it
display the output of what it executes on the target system?  I would
like to create a window in Tktinker to where a user can select options
(such as run scan on remote system) - it would then run the
command-line based scan and return the output.  Does this sound like
something it would do?  Thanks again :)

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


Re: Socket Programming - Question

2006-02-10 Thread D
I've used os.popen() before, but if I execute it on a remote system how
could I get the output back to the requesting machine?

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


Open Relay Test

2006-02-16 Thread D
Hi all .. how could one test to see if an open relay exists on a
specific email server?

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


SonicWALL Configuration

2006-02-17 Thread D
Is it possible to write a Python script to modify/configure a SonicWALL
firewall?  Or, has anyone written any useful utilities for the units
(i.e. parsing the TSR reports, etc.)?  Thanks!

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


Re: Open Relay Test

2006-02-17 Thread D
Nope, quite the contrary..I'm looking to write a simple program for a
client of mine that will, among other things, verify that their
clients' email servers do not have open relays.

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


Re: Open Relay Test

2006-02-19 Thread D
Thanks guys for the info..the DSBL client app is exactly what I
need..unfortunately the app I'm writing will be for Windows (the only
client I saw was for Linux). Do you know if there's a Windows command
line port?

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


Re: Open Relay Test

2006-02-20 Thread D
Thanks, Christoph..in order to automate this in a program (so the test
can be initiated from a system other than the mail server), I'm
thinking it could be automated (via pstools) to run on the system in
question.  I'll give it a try!

Cheers,

Doug

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


Tkinter Checkboxes

2006-02-20 Thread D
Ok, I'm sure this is something extremely simple that I'm missing,
but..how do I set a variable in a Tkinter Checkbox?  i.e. I have a
variable "test" - if the checkbox is selected, I want to set test=1,
otherwise 0.  Thanks!

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


Re: Tkinter Checkboxes

2006-02-21 Thread D
Thank, Mikael..after messing with it for quite awhile, I finally found
out I need the .get()!  Appreciate the help..

Doug

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


Waiting for Connection

2006-02-27 Thread D
I am trying to do the following using Python and Tkinter:

1)  Display a window with 1 button
2)  When user clicks the button, Python attempts to call a function
that opens a socket and listens for a connection - what I want to do
is, if the socket has been successfully opened and the system is
waiting for a connection, to turn the button green.

The problem I'm having is when the button is clicked, the color never
changes and the application "locks up" until the remote end connects
and disconnects.  Where can I put the button configuration statement so
that it will turn green to indicate the socket was opened successfully?
 Thanks!

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


Re: Waiting for Connection

2006-02-27 Thread D
Thanks Kent!  update_idletasks()  does exactly what I needed, which as
you mentioned was just to give it enough time to reconfigure the
button.

Doug

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


Thread Question

2006-02-28 Thread D
I have a client application that I want (behind the scenes) to check
and make sure a remote host is up (i.e. by ping or TCP connect).  I'm
assuming that, since I want this to go on "unknowingly" to the user,
that I would put this in a thread.  My question is, how would I go
about creating the thread?  I have seen examples that used classes, and
other examples that just called one thread start command - when should
you use one over another?  Thanks in advance.

Doug

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


Re: Thread Question

2006-02-28 Thread D
Thanks, Grant.  I apologize for not being clear on what I meant by
using "classes".  This is an example of what I was referring to:
http://www.wellho.net/solutions/python-python-threads-a-first-example.html

See the second (threaded) example.  

Doug

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


Re: Thread Question

2006-02-28 Thread D
Guys - I appreciate the clarification.   So it looks like they used a
class for the ping thread because they were a) running multiple
instances of the thread concurrently and b) needing to keep track of
the state of each instance, correct?  I believe that in my case, since
I will be just running one instance of the thread to ensure that the
remote system is functioning properly, that the single statement should
work just fine.

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


Py2exe

2006-02-28 Thread D
I have a simple client/server file server app that I would like to
convert to a single .exe.  The client is just uses Tkinter and displays
a simple GUI.  The server has no GUI and just listens for and processes
connections.  How can I convert these 2 files to an .exe, while
enabling the server app to register as a Windows service?  Thanks.

Doug

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


Re: Py2exe

2006-02-28 Thread D
Jay - what I'm not sure of is the syntax to use.  I have downloaded and
installed py2exe.

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


Re: Py2exe

2006-02-28 Thread D
Thanks Larry - that is exactly what I needed!  I do have the program
written to be a service, and now plan to use py2exe and Inno Setup to
package it up. 

Doug

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


Stopping Windows Service

2006-03-01 Thread D
I have a simple file server utility that I wish to configure as a
Windows service - using the examples of the Python Win32 book, I
configured a class for the service, along with the main class functions
__init__, SvcStop, and SvcDoRun (which contains my server code).  After
registering the service, I am able to start it with no problems.
However, it never stops correctly (net stop returns "service could not
be stopped") and service is left in a Stopping state. My gut tells me
there's something additional I need to include in the SvcDoRun function
in order to have it shutdown gracefully, but I'm not sure what.  Also,
if that is the case, where should I place the statements within the
function (i.e. right after the listen() statement?)?  Thanks as
always..

Doug

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


Re: newbie question

2006-03-01 Thread D
Yep, that should work.  Just keep in mind that if python.exe is not in
your path, you will need to either specify the entire path to it
(i.e. 'C:\python24\python C:\path\to\script\myscript.py'), or cd into
its directory first (i.e. if you want to just run 'python
C:\path\to\script\myscript.py').

Doug

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


Re: Stopping Windows Service

2006-03-01 Thread D
Thanks guys.  Larry - I inserted the rc lines right after I do the
listen() and the service is not functioning properly (service is
terminating).  Where am I going wrong here?

Doug

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


Re: Stopping Windows Service

2006-03-02 Thread D
I must be missing something..in my SvcDoRun function, first line is
"self.timeout=1" , followed by my "while 1:" loop which listens for
the connection, processes the data, etc.  Where should I place the
"rc=win32event.." and "if rc" lines?  I have a feeling I'm pretty close
here.. :)  Thanks very much.

Doug

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


Re: Stopping Windows Service

2006-03-02 Thread D
Sorry for the many messages, but I've been looking into it further -
since I have the server services listening and waiting for incoming
connections, how would I interrupt it to let the program know that a
stop request has been issued?  For example, if I put the stop check
before it listens, I would think it'd have to wait until it loops back
around after the next client connects.  If I put it after the listen, a
client would have to connect in order for it to run the check..?

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


Using IDLE for checking versions

2005-06-06 Thread d
Okay, so I need to find out what version of wxPython is being used on a
companies computer. I figured I can do this through IDLE, but I cant
find the proper commands. Any help would be appriciated.

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


Re: Using IDLE for checking versions

2005-06-06 Thread d
nvm, i found the wxPython directory with __version__.py which told me
everything i need to know.

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


iPod Library

2007-10-28 Thread D
Is there a Python library available that will allow you to read/write
from the database of an iPod 3G and 5G?  Basically, I'm sick of iTunes
and would much rather write a simple program myself.  Thanks.

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


Tkinter Scrolling

2007-02-01 Thread D
I'm sure this is a simple question to the Tkinter experts - I have a
very basic Tkinter application that consists of 1 master window and
buttons within that window.  My problem is that, I need to be able to
scroll (up and down) when I get to the point that the buttons go off
the screen.  What's the easiest way to do this?  Thanks in advance.

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


Re: Tkinter Scrolling

2007-02-01 Thread D

Bob Greschke wrote:
> On 2007-02-01 05:35:30 -0700, "D" <[EMAIL PROTECTED]> said:
>
> > I'm sure this is a simple question to the Tkinter experts - I have a
> > very basic Tkinter application that consists of 1 master window and
> > buttons within that window.  My problem is that, I need to be able to
> > scroll (up and down) when I get to the point that the buttons go off
> > the screen.  What's the easiest way to do this?  Thanks in advance.
>
> The super-easiest way is to make the "background" a Text() widget, add
> its scrollbars, then add the buttons and whatever else to it.  Of
> course you are then limited to the 'typewriter layout' of widget
> placement.  The typical way to do it is to make a scrolling canvas and
> pack the buttons and other stuff into an empty Frame() and then pack
> the frame on to the canvas, which I haven't had to do yet.
>
> Bob
Thanks, Bob - have you seen any examples of the latter approach (using
a canvas and frame)?  Sounds rather confusing, but it definitely seems
like the approach I need to take.  Thanks again.

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


Re: Tkinter Scrolling

2007-02-02 Thread D
> Here you are:
>
> ---
>  from Tkinter import *
>
> ## Main window
> root = Tk()
> ## Grid sizing behavior in window
> root.grid_rowconfigure(0, weight=1)
> root.grid_columnconfigure(0, weight=1)
> ## Canvas
> cnv = Canvas(root)
> cnv.grid(row=0, column=0, sticky='nswe')
> ## Scrollbars for canvas
> hScroll = Scrollbar(root, orient=HORIZONTAL, command=cnv.xview)
> hScroll.grid(row=1, column=0, sticky='we')
> vScroll = Scrollbar(root, orient=VERTICAL, command=cnv.yview)
> vScroll.grid(row=0, column=1, sticky='ns')
> cnv.configure(xscrollcommand=hScroll.set, yscrollcommand=vScroll.set)
> ## Frame in canvas
> frm = Frame(cnv)
> ## This puts the frame in the canvas's scrollable zone
> cnv.create_window(0, 0, window=frm, anchor='nw')
> ## Frame contents
> for i in range(20):
>b = Button(frm, text='Button n#%s' % i, width=40)
>b.pack(side=TOP, padx=2, pady=2)
> ## Update display to get correct dimensions
> frm.update_idletasks()
> ## Configure size of canvas's scrollable zone
> cnv.configure(scrollregion=(0, 0, frm.winfo_width(), frm.winfo_height()))
> ## Go!
> root.mainloop()
> ---
>
> HTH
> --
> python -c "print ''.join([chr(154 - ord(c)) for c in
> 'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"

Thanks, Eric - exactly what I needed!

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


Active Directory Authentication

2006-05-05 Thread D
Is it possible to have Python authenticate with Active Directory?
Specifically what I'd like to do is have a user enter a
username/password, then have Python check the credentials with AD - if
what they entered is valid, for example, it returns a 1, otherwise a
0..  Thanks!

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


Re: Active Directory Authentication

2006-05-08 Thread D
Thanks to everyone for your help..I'm not familiar with the packages
mentioned, so this will definitely be a learning experience!

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


Python Install

2006-05-18 Thread D
I'm sure this is an easy question for most here, but it's throwing me
for a loop at the moment - I need to upgrade RHEL 3 with the latest
version of Python.  I downloaded the source and installed, but we're
still having problems (i.e. some Python apps don't work, Add/Remove
Applications console errors out and doesn't open, etc.).  My guess is
that it's using old libraries or otherwise conflicting with the old
Python version, but I'm not sure how to remove the original version.
Any help would be greatly appreciated!

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


Re: Python Install

2006-05-18 Thread D
Thanks, Paul - do you know where I can get the RPM?  I only see the
source on the Python website.  Thanks.

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


Re: Python Install

2006-05-19 Thread D
Thanks guys - I will give it another go!

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


Exclude Directories from os.walk

2008-10-21 Thread D
Hello,

How can one exclude a directory (and all its subdirectories) when
running os.walk()?

Thanks,

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


Re: Exclude Directories from os.walk

2008-10-21 Thread D
Ok, my brain's apparently not working right today.. what I'd like to
do is allow the user to specify a directory to exclude (ex- "C:\temp
\test") - then, when os.walk gets to "C:\temp\test", it excludes that
directory and all its subdirectories (so, "C:\temp\mytest\test" should
still be recursed).  Isn't what's posted above keying just upon the
final subdirectory (i.e. "test") instead of the full path as a whole?

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


Re: Exclude Directories from os.walk

2008-10-21 Thread D
On Oct 21, 1:46 pm, "Orestis Markou" <[EMAIL PROTECTED]> wrote:
> You then have to also check the base:
>
> for d in dirs[:]:
>  if os.path.join(base, d) == EXCLUDED_DIR
>    dirs.remove(d)
>
> or
>
> if base == EXCLUDED_DIR
>   while dirs: dirs.pop()
> continue
>
> WARNING: untest code
> - Show quoted text -
>
> On Tue, Oct 21, 2008 at 6:13 PM, D <[EMAIL PROTECTED]> wrote:
> > Ok, my brain's apparently not working right today.. what I'd like to
> > do is allow the user to specify a directory to exclude (ex- "C:\temp
> > \test") - then, when os.walk gets to "C:\temp\test", it excludes that
> > directory and all its subdirectories (so, "C:\temp\mytest\test" should
> > still be recursed).  Isn't what's posted above keying just upon the
> > final subdirectory (i.e. "test") instead of the full path as a whole?
>
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> --
> [EMAIL PROTECTED]://orestis.gr

Works like a charm - thanks to everyone for your help!

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


Backing Up VMWare

2006-04-10 Thread D
Hello - has anyone written a Python script to backup VMWare servers?
If so, I'd appreciate any pointers as to how to go about doing so.
Thanks.

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


Spawning Cmd Window via Subprocess

2009-10-16 Thread D
Hello,

I would like to be able to spawn a new CMD window (specifing size,
color and placement of the window),  and write to it separately.
Specifically, I have a backup program that displays each file backed
up in the main window, and I would like to spawn and continually
update a second CMD window that will display the current status (i.e.
number of files backed up, amount of data backed up).  Also, I only
want to display the update messages, don't want to display any command
prompts.  I'm thinking I should be able to do this using subprocess,
but I haven't been able to find out how.  Any help would be greatly
appreciated!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Spawning Cmd Window via Subprocess

2009-10-18 Thread D
On Oct 16, 5:26 pm, TerryP  wrote:
> On Oct 16, 8:15 pm, D  wrote:
>
> > Hello,
>
> > I would like to be able to spawn a new CMD window (specifing size,
> > color and placement of the window),  and write to it separately.
> > Specifically, I have a backup program that displays each file backed
> > up in the main window, and I would like to spawn and continually
> > update a second CMD window that will display the current status (i.e.
> > number of files backed up, amount of data backed up).  Also, I only
> > want to display the update messages, don't want to display any command
> > prompts.  I'm thinking I should be able to do this using subprocess,
> > but I haven't been able to find out how.  Any help would be greatly
> > appreciated!
>
> you'll likely want to fiddle with subprocess.Popen with the arguments
> set to suitable values to invoke a cmd window and establish pipes for
> communication; see the documentation. If that doesn't work, it would
> probably be time to muck with the Windows API.

Thanks, TerryP..I briefly played around with subprocess.Popen, but so
far no luck (certainly not to say I haven't missed something).  You
could be right that the Win API is needed.. I try to avoid whenever
possible though. :)
-- 
http://mail.python.org/mailman/listinfo/python-list


nimsg -- the Network Instant MeSsenGer

2013-06-14 Thread Hunter D
Some time ago, I posted the code to a p2p instant messaging program to this 
newsgroup.  It was abandoned by me shortly after I posted (no reason, just 
wanted to work on other things).  Anyways, I've worked on this program __a 
lot__ since I posted it here (including giving the program a name change).  The 
program is now known as "nimsg -- the Network Instant MeSsenGer".  So, I 
thought that I would give everybody here a link to the code:
https://github.com/dryad-code/nimsg

Features:
Multiple people can chat at the same time (there is no limit),  
People can pick nicknames to use, and 
You can post multiple times in a row.  

nimsg can be used as an alternative for IRC, for those times that you just want 
to have a small, local chat room.

nimsg was written in Python 2.7.3, and does not require any non-standard 
libraries or modules.

Happy hacking!
Hunter D
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: nimsg -- the Network Instant MeSsenGer

2013-06-14 Thread Hunter D
If you have any suggestions for features, bugs that you want to report, or just 
comments on the program in general, feel free to reply here.
-- 
http://mail.python.org/mailman/listinfo/python-list


must be dicts in tuple

2013-07-25 Thread Tanaya D
Hi,

I am using Python with Bots(EDI translator)

But i am getting the following error:
MappingFormatError: must be dicts in tuple: get((({'BOTSID': 'HEADER'},),))

Can anyone pls help me with it.

Thanks

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


virtualenv problem

2013-07-25 Thread D. Xenakis
Hi there.
Im using windows 7 64bit
I have installed python 3.3.2 in C:\Python33
and then easy_install , pip, and virtualenv.
But i do not know if the virtualenv installation is correct as i cant seem to 
be able to create any virtual enviroment yet.

How can i check if everything is correct? What exactly should i do to create a 
virtual enviroment into my new_project folder located here: in C:\new_project ?
I think there is something wrong with the installation because when i run 
through idle the virtual-env scripts located in "C:\Python33\Scripts" then i 
get the following..

Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:06:53) [MSC v.1600 64 bit 
(AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>  RESTART 
>>> 
You must provide a DEST_DIR
Usage: virtualenv-3.3-script.py [OPTIONS] DEST_DIR

Options:
  --version show program's version number and exit
  -h, --helpshow this help message and exit
  -v, --verbose Increase verbosity
  -q, --quiet   Decrease verbosity
  -p PYTHON_EXE, --python=PYTHON_EXE
The Python interpreter to use, e.g.,
--python=python2.5 will use the python2.5 interpreter
to create the new environment.  The default is the
interpreter that virtualenv was installed with
(C:\Python33\pythonw.exe)
  --clear   Clear out the non-root install and start from scratch
  --no-site-packagesDon't give access to the global site-packages dir to
the virtual environment (default)
  --system-site-packages
Give access to the global site-packages dir to the
virtual environment
  --always-copy Always copy files rather than symlinking
  --unzip-setuptoolsUnzip Setuptools when installing it
  --relocatable Make an EXISTING virtualenv environment relocatable.
This fixes up scripts and makes all .pth files
relative
  --no-setuptools   Do not install setuptools (or pip) in the new
virtualenv.
  --no-pip  Do not install pip in the new virtualenv.
  --extra-search-dir=SEARCH_DIRS
Directory to look for setuptools/pip distributions in.
You can add any number of additional --extra-search-
dir paths.
  --never-download  Never download anything from the network. This is now
always the case. The option is only retained for
backward compatibility, and does nothing. Virtualenv
will fail if local distributions of setuptools/pip are
not present.
  --prompt=PROMPT   Provides an alternative prompt prefix for this
environment
  --setuptools  Backward compatibility. Does nothing.
  --distribute  Backward compatibility. Does nothing.
Traceback (most recent call last):
  File "C:\Python33\Scripts\virtualenv-3.3-script.py", line 9, in 
load_entry_point('virtualenv==1.10', 'console_scripts', 'virtualenv-3.3')()
  File "C:\Python33\lib\site-packages\virtualenv.py", line 786, in main
sys.exit(2)
SystemExit: 2


plz any help appreciated
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: virtualenv problem

2013-07-26 Thread D. Xenakis
Yeah trying to run virtualenv under IDLE was a desperate move as i couldnt make 
anything work under cmd.

Apparently my problem was that i did not have correctly setup the new path.. 

Solution for me was the following from 
"http://forums.udacity.com/questions/100064678/pip-installation-instructions";

--
..We want to add that directory to your Path environment variable. Path is a 
list of directories where your OS looks for executable files. You will need to 
change the directory if you installed Python in a non-default location.

a. go to Control Panel » System » Advanced » Environment Variables, make sure 
Path is selected under "user variables for
user", and click edit.

b. Add ;C:\Python33\Scripts\ and ;C:\Python33\ (no spaces after the previous 
entry, ';' is the delimiter) to the end of variable value, then click ok. You 
should not be erasing anything, just adding to what's already there.

This just makes it so we don't have to type the full path name whenever we want 
to run pip or other programs in those directories.
"C:\Python33\Scripts\" is the one we want now, but "C:\Python33\" might be 
useful for you in the future.

Restart your computer.
--

I realised that even if i didn't do the above, i could still have got things 
rolling just by cd-ing from the cmd, to the script folder of my Python 
installation.

But hey - learning is a good thing
-- 
http://mail.python.org/mailman/listinfo/python-list


PyQt5 and virtualenv problem

2013-07-27 Thread D. Xenakis
I tried to install SIP and PyQt5 using the pip install command but it didnt 
work on both cases (i was getting errors), so i finally installed them using 
the windows installers provided in riverbankcomputing website.
My problem though here is that whenever i try to create a new virtualenv 
enviroment, those packages are not included and i cant import them. How can i 
add PyQt5 to my new virt enviroment? What is the logic behind this problem so i 
understand whats going on here?

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


Re: PyQt5 and virtualenv problem

2013-07-29 Thread D. Xenakis
Answer here: 
http://stackoverflow.com/questions/1961997/is-it-possible-to-add-pyqt4-pyside-packages-on-a-virtualenv-sandbox
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyQt5 and virtualenv problem

2013-07-29 Thread D. Xenakis
Could you help me install PyQt5 properly in my Virtualenv folder and not only 
globally?

I tried installing PyQt5 and sip with the use of pip but i was getting errors 
all the time (Why is that? Are there any known pip issues along with PyQt5 and 
sip?), so in the end i had to install it with the installer provided from the 
official riverbank website.
However now, everytime i create a virtual enviroment, PyQT5 or sip package is 
not included there and i dont know how to solve this problem either.

I tried applying this fix: 
http://stackoverflow.com/questions/1961997/is-it-possible-to-add-pyqt4-pyside-packages-on-a-virtualenv-sandbox
 , but i do not know if i have done things right.
I can import PyQt5 and pip packages from within python console without any 
errors being showed (both globaly and inside my virtuall enviroment), so i 
could assume i did all ok.
But should this confirmation be enough for me or is there any other way i could 
confirm that everything is indeed properly installed?

I noticed that in start menu - programs, a new folder named "PyQt GPL v5.0 for 
Python v3.3 (x64)" had been created after the installation, where someone can 
find view PyQt examples and a PyQT Examples module which starts an application.
Big question now..

Everytime i run PyQt Examples module from within global IDLE, everything works 
ok and then again when i close the application, this appears:
Traceback (most recent call last):
  File "C:\Python33\Lib\site-packages\PyQt5\examples\qtdemo\qtdemo.pyw", line 
91, in 
sys.exit(app.exec_())
SystemExit: 0

However, everytime i run PyQt Examples module from within virtual env IDLE, 
nothing happends.

So as you can undertand, this is why i believe i have not installed properly 
PyQt5 or sip
**(I start virtual env IDLE using this shortcut ""..path..\Python\Python 
Projects\PriceTAG Grabber\env\Scripts\pythonw.exe" 
C:\Python33\Lib\idlelib\idle.pyw")

I know i may have asked too many questions in just a single topic, but all im 
trying to achieve here is to be sure that PyQt5 and virtual env are working 
fine.

Thx for your time in advance
-- 
http://mail.python.org/mailman/listinfo/python-list


Immediate need for Python Developers (Django,mysql, jquery) Work locations Hyderabad/Mumbia, exp: 4-8yrs, please share resumes to [email protected].

2012-10-16 Thread Ayesha D.

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


Storing class objects dynamically in an array

2013-01-21 Thread Brian D
Hi,

I'm trying to instantiate a class object repeated times, dynamically for as 
many times as are required, storing each class object in a container to later 
write out to a database. It kind of looks like what's needed is a 
two-dimensional class object, but I can't quite conceptualize how to do that. 

A simpler approach might be to just store class objects in a dictionary, using 
a reference value (or table row number/ID) as the key. 

In the real-world application, I'm parsing row, column values out of a table in 
a document which will have not more than about 20 rows, but I can't expect the 
document output to leave columns well-ordered. I want to be able to call the 
class objects by their respective row number.

A starter example follows, but it's clear that only the last instance of the 
class is stored. 

I'm not quite finding what I want from online searches, so what recommendations 
might Python users make for the best way to do this? 

Maybe I need to re-think the approach? 


Thanks,
Brian



class Car(object):

def __init__(self, Brand, Color, Condition):
self.Brand = Brand
self.Color = Color
self.Condition = Condition

brandList = ['Ford', 'Toyota', 'Fiat']
colorList = ['Red', 'Green', 'Yellow']
conditionList = ['Excellent', 'Good', 'Needs Help']

usedCarLot = {}

for c in range(0, len(brandList)):
print c, brandList[c]
usedCarLot[c] = Car
usedCarLot[c].Brand = brandList[c]
usedCarLot[c].Color = colorList[c]
usedCarLot[c].Condition = conditionList[c]

for k, v in usedCarLot.items():
print k, v.Brand, v.Color, v.Condition


>>> 
0 Ford
1 Toyota
2 Fiat
0 Fiat Yellow Needs Help
1 Fiat Yellow Needs Help
2 Fiat Yellow Needs Help
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Storing class objects dynamically in an array

2013-01-21 Thread Brian D
On Monday, January 21, 2013 8:29:50 PM UTC-6, MRAB wrote:
> On 2013-01-22 01:56, Brian D wrote:
> 
> > Hi,
> 
> >
> 
> > I'm trying to instantiate a class object repeated times, dynamically for as 
> > many times as are required, storing each class object in a container to 
> > later write out to a database. It kind of looks like what's needed is a 
> > two-dimensional class object, but I can't quite conceptualize how to do 
> > that.
> 
> >
> 
> > A simpler approach might be to just store class objects in a dictionary, 
> > using a reference value (or table row number/ID) as the key.
> 
> >
> 
> > In the real-world application, I'm parsing row, column values out of a 
> > table in a document which will have not more than about 20 rows, but I 
> > can't expect the document output to leave columns well-ordered. I want to 
> > be able to call the class objects by their respective row number.
> 
> >
> 
> > A starter example follows, but it's clear that only the last instance of 
> > the class is stored.
> 
> >
> 
> > I'm not quite finding what I want from online searches, so what 
> > recommendations might Python users make for the best way to do this?
> 
> >
> 
> > Maybe I need to re-think the approach?
> 
> >
> 
> >
> 
> > Thanks,
> 
> > Brian
> 
> >
> 
> >
> 
> >
> 
> > class Car(object):
> 
> >
> 
> >  def __init__(self, Brand, Color, Condition):
> 
> >  self.Brand = Brand
> 
> >  self.Color = Color
> 
> >  self.Condition = Condition
> 
> >
> 
> > brandList = ['Ford', 'Toyota', 'Fiat']
> 
> > colorList = ['Red', 'Green', 'Yellow']
> 
> > conditionList = ['Excellent', 'Good', 'Needs Help']
> 
> >
> 
> > usedCarLot = {}
> 
> >
> 
> > for c in range(0, len(brandList)):
> 
> >  print c, brandList[c]
> 
> >  usedCarLot[c] = Car
> 
> >  usedCarLot[c].Brand = brandList[c]
> 
> >  usedCarLot[c].Color = colorList[c]
> 
> >  usedCarLot[c].Condition = conditionList[c]
> 
> >
> 
> > for k, v in usedCarLot.items():
> 
> >  print k, v.Brand, v.Color, v.Condition
> 
> >
> 
> >
> 
> >>>>
> 
> > 0 Ford
> 
> > 1 Toyota
> 
> > 2 Fiat
> 
> > 0 Fiat Yellow Needs Help
> 
> > 1 Fiat Yellow Needs Help
> 
> > 2 Fiat Yellow Needs Help
> 
> >
> 
> You're repeatedly putting the class itself in the dict and setting its
> 
> (the class's) attributes; you're not even using the __init__ method you
> 
> defined.
> 
> 
> 
> What you should be doing is creating instances of the class:
> 
> 
> 
> for c in range(len(brandList)):
> 
>  print c, brandList[c]
> 
>  usedCarLot[c] = Car(brandList[c], colorList[c], conditionList[c])

Thanks for the quick reply Dave & MRAB. I wasn't even sure it could be done, so 
missing the instantiation just completely slipped. 

The simplest fix is as follows, but Dave, I'll try to tighten it up a little, 
when I turn to the real-world code, following your enumeration example. And 
yes, thanks for the reminder (2.7.3). The output is fine -- I just need a 
record number and the list of values stored in the class object.

This is the quick fix -- instantiate class Car: 

usedCarLot[c] = Car('','','')

It may not, however, be the best, most Pythonic way.

Here's the full implementation. I hope this helps someone else. 

Thanks very much for the help!

class Car(object):

def __init__(self, Brand, Color, Condition):
self.Brand = Brand
self.Color = Color
self.Condition = Condition

brandList = ['Ford', 'Toyota', 'Fiat']
colorList = ['Red', 'Green', 'Yellow']
conditionList = ['Excellent', 'Good', 'Needs Help']

#usedCarLot = {0:Car, 1:Car, 2:Car}
usedCarLot = {}

for c in range(0, len(brandList)):
#print c, brandList[c]
usedCarLot[c] = Car('','','')
usedCarLot[c].Brand = brandList[c]
usedCarLot[c].Color = colorList[c]
usedCarLot[c].Condition = conditionList[c]

for k, v in usedCarLot.items():
print k, v.Brand, v.Color, v.Condition
-- 
http://mail.python.org/mailman/listinfo/python-list


which book?

2012-05-08 Thread d . poreh
folks 
hi, 
I am going to learn python for some plot issues. which book or sources, do you 
recommend please?
Cheers,
Dave
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: which book?

2012-05-14 Thread d . poreh
On Wednesday, May 9, 2012 7:13:54 AM UTC-7, Miki Tebeka wrote:
> > I am going to learn python for some plot issues. which book or sources, do 
> > you recommend please?
> The tutorial is pretty good if you already know how to program.
> I also heard a lot of good things on "Python Essential Reference".

Thanks.
Could you please pass the line for tutorial?
-- 
http://mail.python.org/mailman/listinfo/python-list


Python 3 raising an error where Python 2 did not

2016-08-26 Thread d[email protected]
In a program I'm converting to Python 3 I'm examining a list of divisor values, 
some of which can be None, to find the first with a value greater than 1.

Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> None > 1
False

Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> None > 1
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unorderable types: NoneType() > int()

I can live with that but I'm curious why it was decided that this should now 
raise an error.

David Hughes
Forestfield Software
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3 raising an error where Python 2 did not

2016-08-26 Thread d[email protected]
Thanks for the replies. My example seems to be from the fairly harmless end of 
a wedge of behaviours that are being handled much more sensibly in Python 3.


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


working with classes, inheritance, _str_ returns and a list

2017-01-15 Thread David D
I am creating a parent class and a child class.  I am inheriting from the 
parent with an additional attribute in the child class.  I am using __str__ to 
return the information.  When I run the code, it does exactly what I want, it 
returns the __str__ information.  This all works great. 

BUT

1) I want what is returned to be appended to a list (the list will be my 
database)
2) I append the information to the list that I created
3) Whenever I print the list, I get a memory location

So how do I take the information that is coming out of the child class (as a 
__str__ string), and keep it as a string so I can append it to the list?

pseudo code

allcars=[]

parent class()
   def init (self, model, wheels, doors)
  self.model= model etc

child class (parent)
   def init(self, model, wheels, doors, convertible)
   super(child, self).__init__(model, wheels, doors)
   self.convertible = convertible

   def __str__(self):
return "model: " + self.model + etc

car1= child(model, wheels, doors, convertible)
print car1



Here is where it goes wrong for me


allcars.append(car1)

I am sure I am making a silly mistake in here somewhere...





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


Extract

2018-05-14 Thread mahesh d
Hii
 I have a directory. In that folder .msg files . How can I extract those
files.


Thanks & regards

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


Extract data

2018-05-14 Thread mahesh d
Hii.

 I have folder.in that folder some files .txt and some files .msg files. .
My requirement is reading those file contents . Extract data in that files .
-- 
https://mail.python.org/mailman/listinfo/python-list


Extract data from multiple text files

2018-05-15 Thread mahesh d
import glob,os

import errno

path = 'C:/Users/A-7993\Desktop/task11/sample emails/'

files = glob.glob(path)

'''for name in files:

print(str(name))

if name.endswith(".txt"):

   print(name)'''

for file in os.listdir(path):

print(file)

if file.endswith(".txt"):

print(os.path.join(path, file))

print(file)

try:

with open(file) as f:

msg = f.read()

print(msg)

except IOError as exc:

if exc.errno != errno.EISDIR:

raise


In the above program . Getting lot of errors . My intention is read the
list of the text files in a folder . Print them


 How can resolve those error
-- 
https://mail.python.org/mailman/listinfo/python-list


Read data from .msg all files

2018-05-15 Thread mahesh d
import glob

import win32com.client



files = glob.glob('C:/Users/A-7993/Desktop/task11/sample emails/*.msg')

for file in files:

print(file)

with open(file) as f:

msg=f.read()

print(msg)

outlook =
win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")

msg = outlook.OpenSharedItem(file)

print("FROM:", str(msg.SenderName))

print(msg.SenderEmailAddress)

print(msg.SentOn)

print(msg.To)

print(msg.CC)

print(msg.BCC)

print(msg.Subject)

print(msg.Body)


How can read all .msg files in a folder. I used outlook.openshared item it
only works one file . How can read the data from .msg files
-- 
https://mail.python.org/mailman/listinfo/python-list


Multi-threading with a simple timer?

2018-07-02 Thread David D
Is there a SIMPLE method that I can have a TIMER count down at a user input 
prompt - if the user doesn't enter information within a 15 second period, it 
times out.  I am going to be using pycharm and not the shell.  Thanks in 
advance.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Multi-threading with a simple timer?

2018-07-03 Thread David D
This works, but does not do exactly what I want. What I want to happen is : 
when the user enters in a correct answer, the program and threading stops.  Any 
ideas on what I should change? 

import time 
from threading import Thread 

class Answer(Thread): 
def run(self): 
a=input("What is your answer:") 
if a=="yes": 
print("yes you got it") 
finished() 
else: 
print("no") 

class myTimer(Thread): 
def run(self): 
print() 
for x in range(5): 

time.sleep(1) 

Answer().start() 
myTimer().start() 
print("you lost") 

def finished(): 
print("done")

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


Re: Multi-threading with a simple timer?

2018-07-03 Thread David D
This works, but does not do exactly what I want. When the user enters in a 
correct answer, the program and threading stops.  Any ideas on what I should 
change?

import time
from threading import Thread

class Answer(Thread):
def run(self):
a=input("What is your answer:")
if a=="yes":
print("yes you got it")
finished()
else:
print("no")

class myTimer(Thread):
def run(self):
print()
for x in range(5):

time.sleep(1)

Answer().start()
myTimer().start()
print("you lost")

def finished():
print("done")

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


Re: Multi-threading with a simple timer?

2018-07-03 Thread David D
I have some success with this.  I am not sure if this would work longer term, 
as in restarting it, but so far so good.  Any issue with this new code?

import time
from threading import Thread

th=Thread()
class Answer(Thread):
def run(self):
a=input("What is your answer:")
if a=="yes":
print("yes you got it")
th.daemon=False
else:
print("no")

class myTimer(Thread):
def run(self):
print()

for x in range(5):
if th.daemon==True:
print(x)
time.sleep(1)
else:
break

th.daemon=True

Answer().start()
myTimer().start()


def finished():
print("done")

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


Fetch data from two dates query in python and mongoengine

2018-08-23 Thread mahesh d
Hii
My model like this
class ProcessedEmails(Document):
  subject = StringField(max_length=200)
fromaddress =StringField(max_length=200)
 dateofprocessing = StringField(max_length=25)
How can find out the records between two dates ??
Note: date of processing is string field
 Mongodb database using .
How to write the query in python by using mongoengine

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


Re: Fetch data from two dates query in python and mongoengine

2018-08-24 Thread mahesh d
Thanks!

On Fri 24 Aug, 2018, 9:01 PM Kunal Jamdade, 
wrote:

> Hi Mahesh,
>
> Import Q from queryset.
>
> from mongoengine.queryset.visitor import Q
>
> ProcessedEmails.objects(Q(first_date) & Q(second_date))
>
>
>
> On Fri, Aug 24, 2018 at 12:41 PM mahesh d  wrote:
>
>> [image: Boxbe] <https://www.boxbe.com/overview> This message is eligible
>> for Automatic Cleanup! ([email protected]) Add cleanup rule
>> <https://www.boxbe.com/popup?url=https%3A%2F%2Fwww.boxbe.com%2Fcleanup%3Fkey%3D6shxV8TWSzohw7mx55CRTYGVUY%252F%252FUzgpidJKOL6DPTk%253D%26token%3Di2FjTl%252FO8mAwgqs0qhzOJeuhrkyh9QSqLpzpjt2QGdooZjs2O6iBTYSl%252BJH40Q4ohQceN%252FEvdtQjwBD89TS87YKbX1rR%252BK4ufxoZ7yN4tsFOubjkC91wlF7nlodh1CC8JJheu%252FEGxgpj4VWoEwhlKw%253D%253D&tc_serial=42465772179&tc_rand=687678035&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001>
>> | More info
>> <http://blog.boxbe.com/general/boxbe-automatic-cleanup?tc_serial=42465772179&tc_rand=687678035&utm_source=stf&utm_medium=email&utm_campaign=ANNO_CLEANUP_ADD&utm_content=001>
>> Hii
>> My model like this
>> class ProcessedEmails(Document):
>>   subject = StringField(max_length=200)
>> fromaddress =StringField(max_length=200)
>>  dateofprocessing = StringField(max_length=25)
>> How can find out the records between two dates ??
>> Note: date of processing is string field
>>  Mongodb database using .
>> How to write the query in python by using mongoengine
>>
>> Thanks
>> Mahesh D.
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: make an object read only

2016-08-02 Thread d[email protected]
On Tuesday, 2 August 2016 16:13:01 UTC+1, Robin Becker  wrote:
> A reportlab user found he was doing the wrong thing by calling canvas.save 
> repeatedly, our documentation says you should not use Canvas objects after 
> the 
> save method has been used. The user had mixed results :(
> 
> It would be better to make the canvas object completely immutable all the way 
> down when save has been called, ..
> 
> Is there a way to recursively turn everything immutable?
> -- 
> Robin Becker

Years ago I contributed a recipe to the O'Reilly Python Cookbook, 2nd Ed - 6.12 
Checking an Instance for any State Changes. My original submission was rather 
more naive than that but Alex Martelli, one of the editors, rather took a fancy 
to the idea and knocked into the more presentable shape that got published. I'm 
wondering whether there would be any way of turning this idea around to achieve 
what you want.
--
Regards
David Hughes
Forestfield Software
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Alternatives to Stackless Python?

2005-09-22 Thread D H
[EMAIL PROTECTED] wrote:
> After recently getting excited about the possibilities that stackless
> python has to offer
> (http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/)
> and then discovering that the most recent version of stackless
> available on stackless.com was for python 2.2 I am wondering if
> Stackless is dead/declining and if so, are there any viable
> alternatives that exist today?
> 
> I found LGT http://lgt.berlios.de/ but it didn't seem as if the
> NanoThreads module had the same capabilites as stackless.
> 

See also greenlets, which work with regular cpython:
http://codespeak.net/py/current/doc/greenlet.html
http://agiletesting.blogspot.com/2005/07/py-lib-gems-greenlets-and-pyxml.html

You'll probably need to get it via an svn client (such as tortoisesvn on 
windows): http://codespeak.net/py/current/doc/getting-started.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Django Vs Rails

2005-09-25 Thread D H
Jaroslaw Zabiello wrote:
> Dnia 24 Sep 2005 22:48:40 -0700, [EMAIL PROTECTED] napisał(a):
> 
> 
>>You should give TurboGears a try.
> 
> This project is good only for fun and  playing not for enterprise.

That's my kind of project :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cElementTree clear semantics

2005-09-25 Thread D H
Igor V. Rafienko wrote:
> This gave me the desired behaviour, but:
> 
> * It looks *very* ugly
> * It's twice as slow as version which sees 'end'-events only.
> 
> Now, there *has* to be a better way. What am I missing?
> 

Try emailing the author for support.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cElementTree clear semantics

2005-09-25 Thread D H
Reinhold Birkenfeld wrote:
> D H wrote:
> 
>>Igor V. Rafienko wrote:
>>
>>>This gave me the desired behaviour, but:
>>>
>>>* It looks *very* ugly
>>>* It's twice as slow as version which sees 'end'-events only.
>>>
>>>Now, there *has* to be a better way. What am I missing?
>>>
>>
>>Try emailing the author for support.
> 
> 
> I don't think that's needed. He is one of the most active members
> of c.l.py, and you should know that yourself.
> 

I would recommend emailing the author of a library when you have a 
question about that library.  You should know that yourself as well.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cElementTree clear semantics

2005-09-25 Thread D H
Reinhold Birkenfeld wrote:

> 
> Well, if I had e.g. a question about Boo, I would of course first ask
> here because I know the expert writes here.
> 
> Reinhold

Reinhold Birkenfeld also wrote:
 > If I had wanted to say "you have opinions? fuck off!", I would have said
 >"you have opinions? fuck off!".


Take your own advice asshole.
-- 
http://mail.python.org/mailman/listinfo/python-list


Reinhold Birkenfeld [was "Re: cElementTree clear semantics"]

2005-09-25 Thread D H
D H wrote:
> Reinhold Birkenfeld wrote:
> 
>>
>> Well, if I had e.g. a question about Boo, I would of course first ask
>> here because I know the expert writes here.
>>
>> Reinhold
> 
> 
> Reinhold Birkenfeld also wrote:
>  > If I had wanted to say "you have opinions? fuck off!", I would have said
>  >"you have opinions? fuck off!".
> 
> 
> Take your own advice asshole.

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


Reinhold Birkenfeld [Re: "Re: cElementTree clear semantics"]

2005-09-25 Thread D H
Reinhold Birkenfeld wrote:
> D H wrote:
> 
>>D H wrote:
>>
>>>Reinhold Birkenfeld wrote:
>>>
>>>
>>>>Well, if I had e.g. a question about Boo, I would of course first ask
>>>>here because I know the expert writes here.
>>>>
>>>>Reinhold
>>>
>>>
>>>Reinhold Birkenfeld also wrote:
>>> > If I had wanted to say "you have opinions? fuck off!", I would have said
>>> >"you have opinions? fuck off!".
>>>
>>>
>>>Take your own advice asshole.
> 
> 
> And what's that about?

I think it means you should fuck off, asshole.
-- 
http://mail.python.org/mailman/listinfo/python-list


Reinhold Birkenfeld [Re: "Re: cElementTree clear semantics"]

2005-09-25 Thread D H
Reinhold Birkenfeld wrote:
> D H wrote:
> 
>>Reinhold Birkenfeld wrote:
>>
>>>D H wrote:
>>>
>>>
>>>>D H wrote:
>>>>
>>>>
>>>>>Reinhold Birkenfeld wrote:
>>>>>
>>>>>
>>>>>
>>>>>>Well, if I had e.g. a question about Boo, I would of course first ask
>>>>>>here because I know the expert writes here.
>>>>>>
>>>>>>Reinhold
>>>>>
>>>>>
>>>>>Reinhold Birkenfeld also wrote:
>>>>>
>>>>>>If I had wanted to say "you have opinions? fuck off!", I would have said
>>>>>>"you have opinions? fuck off!".
>>>>>
>>>>>
>>>>>Take your own advice asshole.
>>>
>>>
>>>And what's that about?
>>
>>I think it means you should fuck off, asshole.
> 
> 
> I think you've made that clear.
> 
> *plonk*
> 
> Reinhold
> 
> PS: I really wonder why you get upset when someone except you mentions boo.

You're the only one making any association between this thread about 
celementree and boo.  So again I'll say, take your own advice and fuck off.
-- 
http://mail.python.org/mailman/listinfo/python-list


Fredrik Lundh [Re: Reinhold Birkenfeld [Re: "Re: cElementTree clear semantics"]]

2005-09-25 Thread D H
Fredrik Lundh wrote:
> Doug Holton wrote:
> 
> 
>>You're the only one making any association between this thread about
>>celementree and boo.
> 
> 
> really?  judging from the Original-From header in your posts, your internet
> provider is sure making the same association...

You seriously need some help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cElementTree clear semantics

2005-09-25 Thread D H
Grant Edwards wrote:
> On 2005-09-25, D H <[EMAIL PROTECTED]> wrote:
> 
>>>>Igor V. Rafienko wrote:
>>>>
>>>>
>>>>>This gave me the desired behaviour, but:
>>>>>
>>>>>* It looks *very* ugly
>>>>>* It's twice as slow as version which sees 'end'-events only.
>>>>>
>>>>>Now, there *has* to be a better way. What am I missing?
>>>>
>>>>Try emailing the author for support.
>>>
>>>I don't think that's needed. He is one of the most active
>>>members of c.l.py, and you should know that yourself.
>>
>>I would recommend emailing the author of a library when you
>>have a question about that library.  You should know that
>>yourself as well.
> 
> 
> Why??

Please tell me I don't have to explain to you why the author of a 3rd 
party library might be able to answer a question specific to that library.


> For the things I "support", I much prefer answering questions
> in a public forum.  

Right, which is exactly why we have sourceforge, tigris, google groups, 
and numerous other free resources where you can set up a mailing list to 
publicly ask and answer questions about your software.
Of course it may not get you as many paypal hits as spamming larger 
forums with your support questions will, but it is the decent thing to do.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cElementTree clear semantics

2005-09-25 Thread D H
Fredrik Lundh wrote:
> Paul Boddie wrote:
> 
> 
>>Regardless of anyone's alleged connection with Boo or newsgroup
>>participation level, the advice to contact the package
>>author/maintainer is sound. It happens every now and again that people
>>post questions to comp.lang.python about fairly specific issues or
>>packages that would be best sent to mailing lists or other resources
>>devoted to such topics. It's far better to get a high quality opinion
>>from a small group of people than a lower quality opinion from a larger
>>group or a delayed response from the maintainer because he/she doesn't
>>happen to be spending time sifting through flame wars amidst large
>>volumes of relatively uninteresting/irrelevant messages.
> 
> 
> well, for the record, I strongly recommend people to post questions in
> public forums.  google is far more likely to pick up answers from mailing
> list archives and newsgroups than from the "I really should do something
> about all the mails in my support folder" part of my brain.

You run your own server and get plenty of paypal donations.  Why not run 
your own mailing list for support?  If not, see sourceforge or google 
groups: http://groups.google.com/groups/create?lnk=l&hl=en
-- 
http://mail.python.org/mailman/listinfo/python-list


Grant Edwards [Re: cElementTree clear semantics]

2005-09-25 Thread D H
Grant Edwards wrote:
> On 2005-09-25, D H <[EMAIL PROTECTED]> wrote:
> 
> 
>>>>I would recommend emailing the author of a library when you
>>>>have a question about that library.  You should know that
>>>>yourself as well.
>>>
>>>Why??
>>
>>Please tell me I don't have to explain to you why the author
>>of a 3rd party library might be able to answer a question
>>specific to that library.
> 
> 
> Of course not.  And when that author reads this group, why not
> post questions here so that everybody can benefit from the
> information?

When did I ever argue against that?  I was suggesting a resource to use 
to support your own software.  I think you have assumed that I suggested 
posting here about celementree was off-topic.  Tell me where I ever said 
that.  I said to the first guy that he should ask the author for help, 
meaning that he could get help that way as well.  Furthermore, I believe 
that is the more efficient way to get help, by contacting the author 
directly, especially if that author is too lazy to set up their own 
support forum or list.


>>>For the things I "support", I much prefer answering questions
>>>in a public forum.  
>>
>>Right, which is exactly why we have sourceforge, tigris,
>>google groups,
> 
> 
> Exactly how do you think c.l.p on google groups differs from
> c.l.p on the rest of Usenet?

Who the fuck said that?  Are you pulling this shit out of your ass?


>>and numerous other free resources where you can set up a
>>mailing list to publicly ask and answer questions about your
>>software. Of course it may not get you as many paypal hits as
>>spamming larger forums with your support questions will,
> 
> 
> WTF are you on about?  What the hell is a "Paypal hit"?  How is
> posting a single, on-topic, question to c.l.p "spamming"?

Fredrik Lundh gets money via paypal on his site where his software is 
located.  That's what I meant.  Where did I say this particular post is 
a spam?  Again, your ass?  where do you get this shit?

> 
>>but it is the decent thing to do.
> 
> 
> You sir, are a loon.
> 

You're a funny ass.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "no variable or argument declarations are necessary."

2005-10-02 Thread D H
James A. Donald wrote:
> I am contemplating getting into Python, which is used by engineers I
> admire - google and Bram Cohen, but was horrified to read
> 
> "no variable or argument declarations are necessary."
> 
> Surely that means that if I misspell a variable name, my program will
> mysteriously fail to work with no error message.
> 
> If you don't declare variables, you can inadvertently re-use an
> variable used in an enclosing context when you don't intend to, or
> inadvertently reference a new variable (a typo) when you intended to
> reference an existing variable.
> 
> What can one do to swiftly detect this type of bug?

It's a fundamental part of python, as well as many other scripting 
languages.
If you're not comfortable with it, you might try a language that forces 
you to declare every variable first like java or C++.
Otherwise, in python, I'd recommend using variable names that you can 
easily spell.  Also do plenty of testing of your code.  It's never been 
an issue for me, although it would be nicer if python were 
case-insensitive, but that is never going to happen.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parrot & Python ?

2005-10-02 Thread D H
Do Re Mi chel La Si Do wrote:
> Hi !
> 
> On the site of Amber :  http://xamber.org/index.html
> We can to view the sentence : "Parrot version of Python"
> Question :  what is "Parrot version of Python" ?
> 

Parrot is a virtual machine runtime, like the java vm or .NET CLR.
http://www.parrotcode.org/
People are working on making various scripting languages run on top of 
the parrot vm, like the Amber language you found, and python 
http://pirate.tangentcode.com/ and Lua 
http://members.home.nl/joeijoei/parrot/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New project coming up...stay with Python, or go with a dot net language??? Your thoughts please!

2005-10-03 Thread D H
spiffo wrote:
> Ok, I LOVE python, so that is not the issue, but, I am getting very worried
> about it's growth. I recently re-visted the web looking at alot of projects
> I assumed would be up and running by now from over a year ago, such as Boa
> Constructor, Iron Python etc... it seems all these projects get started, but
> never finished.
> 
> Also, more and more I need *complete* control of ms sql from my apps, which
> is simply not available from the adodbapi module I got off the internet...
> also, ms sql 2005 is getting ready to come out... what if the guy that wrote
> adodbapi.py does not feel like upgrading it so it even works with MS SQL
> SERVER 2005? Yeesh... you get the picture...

If everything revolves tightly around a microsoft product (ms sql 2005, 
which isn't even released yet), you probably are boxed in more towards 
other microsoft products.  That's vendor lock-in for you.  You might try 
VS.NET 2005 and see if C# or VB.NET and the ADO.NET api work well for 
you:  http://lab.msdn.microsoft.com/vs2005/
Of course that plus ms sql 2005 will end up costing a great deal of 
money.  Plus none of it is cross-platform, but you already said you do 
not need that.

There are free .NET alternatives like Mono, Sharpdevelop, boo ( 
http://boo.codehaus.org/ ) and nemerle, but they are not caught up with 
.NET 2 stuff yet.  Again, it hasn't even been released yet, and there 
are still bugs in their beta versions.
So it wouldn't surprise me if the python libraries can't handle ms sql 
2005-specific stuff yet either.

So, if you need a short answer now, I'd say go with vs.net 2005, but if 
you can afford to wait a while, free python and .net alternatives will 
catch up.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: New project coming up...stay with Python, or go with a dot net language??? Your thoughts please!

2005-10-04 Thread D H
Istvan Albert wrote:
> Disclaimer: this is not a flame against Boo.
> 
> It just boggles my mind that a language that describes itself as
> "python inspired syntax" keeps being touted as:
> 
> 
>>Luis M. Gonzalez wrote:
>>Boo (which could be considered almost an static version of Python for .NET)
> 
> 
> Boo is *nothing* like a static version of Python. Stop perpetuating
> this nonsense.


There is no static version of python, only a proposal[1] which was 
quickly stomped on and revised to be about slower runtime type-checking:

def gcd(a: int, b: int) -> int:
 while a:
 a, b = b%a, a
 return b

The boo equivalent is: (http://boo.codehaus.org/)

def gcd(a as int, b as int) as int:
 while a:
 a, b = b%a, a
 return b

Looks "nearly identical" to me.

(Istvan has been a long spewer of anti-boo FUD on this list)

[1] http://www.artima.com/weblogs/viewpost.jsp?thread=85551
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: more than 100 capturing groups in a regex

2005-10-26 Thread D H
Fredrik Lundh wrote:
> Joerg Schuster wrote:
> 
> 
>>>if you want to know why 100 is a reasonable and non-random choice, I
>>>suggest checking the RE documentation for "99 groups" and the special
>>>meaning of group 0.
>>
>>I have read everything I found about Python regular expressions. But I
>>am not able to understand what you mean. What is so special about 99?
> 
> 
> it's the largest number than can be written with two decimal digits.


It's a conflict between python's syntax for regex back references and 
octal number literals.  Probably wasn't noticed until way too late, and 
now it will never change.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: NEWBIE

2005-10-26 Thread D H
[EMAIL PROTECTED] wrote:
> brenden wrote:
> 
>>hey everyonei'm new to all this programming and all this stuff and
>>i just wanted to learn how to do it...
>>
>>does anyone think they can teach me how to work with python?
> 
> 
> Don't waste readers' time with such vague and broad requests. Instead,
> post a specific question, for example showing a small fragment of
> Python code that does not work as you expect. Or ask how to do XYZ in
> Python, if you are unable to find the answer using Google.
> 
> "Newbie" by itself is always a bad subject line. Having a specific
> question should help you form a better title for your message.


As you can see, you won't find help here.  You will get a lot of great 
advice and help on the python-tutor list, which is for beginners such as 
yourself:
http://mail.python.org/mailman/listinfo/tutor
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Hi All - Newby

2005-10-26 Thread D H
Ask wrote:
> 
> I found a link to this newsgroup, downloaded 1000 messages, 

You might check out the python-tutor list if you have beginner 
questions: http://mail.python.org/mailman/listinfo/tutor


> I must admit to much confusion regarding some of the basics, but I'm sure 
> time, reading, and good advice will get rid of that. at this stage, it's 
> just working through some examples and getting my head around things. As an 
> example, if I create a window, I've been unable to force it to be a certain 
> size, and put a button (widget) at (say) 20,40 (x & y). Is window formatting 
> possible?

You might also see wxpython: http://www.wxpython.org/  The "wiki" there 
has some examples and beginner resources.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: RAW_INPUT

2005-11-07 Thread A D
On Mon, 2005-11-07 at 07:57 -0800, john boy wrote:
> I am having trouble with the following example used in a tutorial:
>  
> print "Halt !"
> s = raw_input ("Who Goes there? ")
> print "You may pass,", s

at this print line you need to do 
print "you may pass, %s" % s

this will allow you to enter the string s into the output sentence

>  
> I run this and get the following:
> Halt!
> Who Goes there?
>  
> --thats itif I hit enter again "You may pass,"
> appears...
>  
> In the example after running you should get:
>  
> Halt!
> Who Goes there? Josh
> You may pass, Josh
>  
> I'm assuming s=Josh...but that is not included in the statement at all
> I don't know how you put "Josh" in or how you got it to finish running
> w/o hitting enter after "Who goes there?"
>  
> What am I doing wrong?
>  
> thanks,
> -xray-
> 
> 
> __
> Yahoo! FareChase - Search multiple travel sites in one click. 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

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


Re: ANN: Circe 0.0.3b1 released

2005-11-08 Thread Nick D.
Matthew Nuzum  gmail.com> writes:

> 
> Hello,
> 
> I'm curious, does Circe use threading? I have been frustrated that
> some of the things I've wanted to do required threading, but haven't
> found much documentation or good examples of using threading with
> wxPy.
> 
> I'm eager to disect the source of something that successfully combines the 
> two.
> 
> --
> Matthew Nuzum
> www.bearfruit.org


Circe, as of this time, does not contain any threading code. We are planning in
the future to possibly add threading when we decide to implement DCC support.
Please check in when we have added that feature, we might have added some
threading.

Thanks,

Nick D.
http://circe.nick125.com

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


  1   2   3   4   5   6   >