OpenCV Object Detection

2011-07-15 Thread T
Hi all.. what is the best way (using OpenCV) to go about detecting
objects by color?  Specifically, I need to detect multiple objects -
first, a main object (a coin), then multiple objects within that main
(green particles on the coin).  I'm finding lots of info about facial
recognition, but not much in the way of just detecting by color.  In
this case, the coin will always be silver and the particles contained
on it will always be some shade of green.

Accuracy is very important - which is why I figured detecting via
color would be the way to go.  My goal is to detect as close to the
exact size of the coin/particles as possible.  That said, if there are
more accurate ways out there I'm open to suggestions!  Thanks in
advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Distributing Python Program

2011-03-19 Thread T
I have a Python program (which I've "frozen" via py2exe) that I'd like
to distribute online, but I'm not sure of the steps to take.  My
thoughts were to create an account with RegNow or FastSpring, who
could accept the payment and offer the download, but I'm unsure as to
how you deal with licensing issues (i.e. how do you implement license
keys)?  I'm only looking to sell the program for around $40, so this
is by no means a huge expense to a business - however, I'd like to at
least have something in place that would make it a bit more difficult
for the software to be pirated (or used above than the paid number of
licenses).  Thanks in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Threading with Socket Server

2011-03-23 Thread T
Hello all, I am writing a Windows service that needs to 1) Act as a
server (TCP), and write to a shelve file, and 2) Read that same shelve
file every x number of seconds.  My thought is to create 2 separate
classes (1 for the socket server and writing to the shelve file, and
another to read the file and perform other requested actions) -
however, I need to make sure they are both running concurrently.   I'm
sure threading is involved, but my experience with it has been
minimal, so any help to steer me in the right direction is greatly
appreciated.
-- 
http://mail.python.org/mailman/listinfo/python-list


Validating Command Line Options

2011-03-23 Thread T
For a Python script with multiple command line options, what is the
best way to go about validating that only certain options are used
together?  For example, say -s, -t, and -v are all valid options, but
should never be used together (i.e. -s -t would be invalid).  Thanks
in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Validating Command Line Options

2011-03-23 Thread T
Thanks!  argparse is definitely what I need..unfortunately I'm running
2.6 now, so I'll need to upgrade to 2.7 and hope that none of my other
scripts break.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Threading with Socket Server

2011-03-23 Thread T
The server portion of the program will typically be writing to the
shelve file (there may be a few cases in which I will need it to
read), and the other part of the program will read it.  Basically, I
want the following to be able to both go on at the same time:  1)
Server portion waits for connections, and upon connection writes data
received to shelve file   and   2) Continuously polls shelve file
every x seconds and checks for new entries.  I had given thought to
the potential of a race condition as you mentioned, but am not sure of
how to "safely" allow each portion of the program to read/write.
-- 
http://mail.python.org/mailman/listinfo/python-list


No need to close file?

2006-07-18 Thread T
Do I need to close the file in this case?  Why or why not?

for line in file('foo', 'r'):
  print line

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


Re: No need to close file?

2006-07-18 Thread T
Thomas Bartkus wrote:
> "T" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Do I need to close the file in this case?  Why or why not?
> >
> > for line in file('foo', 'r'):
> >   print line
>
> Are you asking if you can get away without closing it?
> Or are you asking if it is a good idea to not close it?
>
> Good programming practice says that if you open it - you close it.
>
> And stay out of trouble ;-)
> Thomas Bartkus



How do I close the file in the above case?

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


Isn't there a better way?

2006-07-21 Thread T

I am using an optparse to get command line options, and then pass them
to an instance of another class:



# Class that uses optparse.OptionParser
foo = Parse_Option()

# Class that does the real work
bar = Processor()

bar.index = foo.options.index
bar.output  = foo.options.output
bar.run()



This works, but it feels hokey or unnatural to "pass" data from one
class to another.  Isn't there a better way???

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


Re: Isn't there a better way?

2006-07-21 Thread T
> I don't know what both classes do [snip]

foo basically gets values for verbose (a True or False) and index (an
integer) from command line options, using
optparse.OptionParser.add_option() and
optparse.OptionParser.parse_args()

I would like bar to access the values of verbose and index.  Is there
another way?

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


Re: Isn't there a better way?

2006-07-21 Thread T

T wrote:
> > I don't know what both classes do [snip]
>
> foo basically gets values for verbose (a True or False) and index (an
> integer) from command line options, using
> optparse.OptionParser.add_option() and
> optparse.OptionParser.parse_args()
>
> I would like bar to access the values of verbose and index.  Is there
> another way?

Sorry... I meant to say:

"foo basically gets values for index (an integer) and output (a string)"

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


An optparse question

2006-07-21 Thread T
I have a short program using optparse.OptionParser that prints out help
message with -h flag:

% myprog.py -h
usage: myprog.py [options] input_file

options:
  -h, --help show this help message and exit
  -v, --verboseprint program's version number and exit
  -o FILE   Output file


My question is, is there a way to print a blank line (or any string)
before "usage: myprog.py [options] input_file" ?  I tried using
callbacks without success.  I think somehow I need to modify the
behavior of optparse.OptionParser.print_usage() function?

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


Re: An optparse question

2006-07-21 Thread T
fuzzylollipop wrote:
>
> you can make the usage line anything you want.
>
> ...
> usage = 'This is a line before the usage line\nusage %prog [options]
> input_file'
> parser = OptionsParser(usage=usage)
> parser.print_help()
> ...
>

No, that affects the string printed only *after* the "usage = " string.
 What I would like to do is insert some string *before* the "usage = "
string, which is right after the command I type at the command prompt.
So I would like to make it look like this:

% myprog.py -h
 THIS IS NEWLY INSERTED STRING 
usage: myprog.py [options] input_file


options:
  -h, --help show this help message and exit
  -v, --verboseprint program's version number and exit
  -o FILE   Output file

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


Accessing Yahoo Mail withtout POP

2006-08-08 Thread T
Is there a way to access yahoo mail via its web interface?  If so, can
someone give some pointers?

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


How to delete a directory tree in FTP

2006-08-16 Thread T
I connect to a FTP server which can be either unix or windows server.
Once in the FTP session, I would like to delete a directory tree on the
server.  Is there a command that will do this?  If not, can someone
point me to a right direction?

Thanks!

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


Re: How to delete a directory tree in FTP

2006-08-17 Thread T

That looks useful.  Thanks!

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


Newbie RE question

2006-09-22 Thread T
I would like to search for any of the strings in r'/\:*?"<>|' in a
string using RE module.  Can someone tell me how?

Thanks!

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


Re: Newbie RE question

2006-09-22 Thread T
I meant to say:  Search for any character in r'/\:*?"<>|' in a string
Sorry

T wrote:
> I would like to search for any of the strings in r'/\:*?"<>|' in a
> string using RE module.  Can someone tell me how?
> 
> Thanks!

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


License / Registration key enabled software

2006-09-22 Thread T
We all know that there are many softwares that require some license key
or registration key to enable them.  How does one implement something
like this in python?

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


Re: License / Registration key enabled software

2006-09-23 Thread T

Umm...I was hoping for something simpler and more straight forward.  Is
there a module that would be useful for this type of thing?

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


Re: License / Registration key enabled software

2006-10-02 Thread T
Mike Playle wrote:
> The people who want to use your software illegitimately will succeed no
> matter what you do, so you shouldn't worry about them. Worry instead about
> the people who DON'T want to use it illegitimately. Can a license key
> scheme help them? If so, implement it. No trickery is needed - a simple
> comparison will suffice.
>
> Mike

Oh man.  This is going way off topic!!!

I just wanted to know how license / registration key can be implemented
in python.  I was not interested in philosophical discussion of why /
why not one should implement it, whether that business model make
sense, instead using smartcards, etc. etc.

I would like to satisfy technical / intellectual curiosity of how it is
done in python -- so how about returning to the original topic of "How
can license / registration key be implemented in python?"

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


Re: How to use os.putenv() ?

2007-08-30 Thread T
On Aug 29, 9:50 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Aug 30, 11:21 am, [EMAIL PROTECTED] wrote:
>
>
>
> > >>> import os
>
> > >>> os.environ['PATH']
>
> > 'C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem;%C:\\WINNT%\
> > \system32;%C:\\WINNT%;%C:\\WINNT%\\System32\\Wbem'
>
> > >>> os.putenv('PATH', 'C:\\WINNT\\system32')
>
> > >>> os.environ['PATH']
>
> > 'C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem;%C:\\WINNT%\
> > \system32;%C:\\WINNT%;%C:\\WINNT%\\System32\\Wbem'
>
> > What am I doing wrong?  How do I change the value of an environment
> > variable?
>
> What you are missing is that os.environ is only populated from the
> global process environment at process startup.
>
> If you update os.environ the changes will be pushed into the global
> process environment as well. But if you use os.putenv() instead,
> bypassing os.environ, the changes will not show in os.environ.
>
> To confirm that the global process environment is being updated, use
> os.getenv().
>
> Graham

Can you tell me what I am still missing please?

>>> import os
>>>
>>> os.getenv('PATH')
'C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem;%C:\\WINNT%\
\system32;%C:\\WINNT%;%C:\\WINNT%\\System32\\Wbem'
>>>
>>> os.putenv('PATH', 'C:\\WINNT\\system32')
>>>
>>> os.getenv('PATH')
'C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem;%C:\\WINNT%\
\system32;%C:\\WINNT%;%C:\\WINNT%\\System32\\Wbem'
>>>

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


Re: How to use os.putenv() ?

2007-08-30 Thread T
Thank you everyone!

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


Executing Commands From Windows Service

2010-02-07 Thread T
I have a script, which runs as a Windows service under the LocalSystem
account, that I wish to have execute some commands.  Specifically, the
program will call plink.exe to create a reverse SSH tunnel.  Right now
I'm using subprocess.Popen to do so.  When I run it interactively via
an admin account, all is well.  However, when I'm running it via
service, no luck.  I'm assuming this is to do with the fact that it's
trying to run under the LocalSystem account, which is failing.  What
would be the best way around this?  Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Executing Commands From Windows Service

2010-02-07 Thread T
On Feb 7, 4:43 pm, Sean DiZazzo  wrote:
> On Feb 7, 11:02 am, T  wrote:
>
> > I have a script, which runs as a Windows service under the LocalSystem
> > account, that I wish to have execute some commands.  Specifically, the
> > program will call plink.exe to create a reverse SSH tunnel.  Right now
> > I'm using subprocess.Popen to do so.  When I run it interactively via
> > an admin account, all is well.  However, when I'm running it via
> > service, no luck.  I'm assuming this is to do with the fact that it's
> > trying to run under the LocalSystem account, which is failing.  What
> > would be the best way around this?  Thanks!
>
> Try running/debugging your service from the commandline as
> " debug"  That should lead you to the error.
>
> Otherwise, we need to see a traceback and some code to be better able
> to help.
>
> ~Sean

It's working fine when I run it via " debug" - that's how
I was testing before.  It's when I start the service that it fails -
and you can see that, when you run it with debug, plink.exe runs under
my username.  When I run it as a service, it runs under System...
-- 
http://mail.python.org/mailman/listinfo/python-list


Modifying Class Object

2010-02-07 Thread T
Ok, just looking for a sanity check here, or maybe something I'm
missing.  I have a class Test, for example:

class Test:
def __init__(self, param1, param2, param3):
self.param1 = param1
self.param2 = param2
self.param3 = param3

Next, I have a dictionary mytest that contains instances of Test.  If
I want to modify one of the Test instances within my dictionary, I
have to rewrite the entire entry, correct (since Python passes by
value, not reference)?  I.e. if I wish to change just param3 of an
instance, I would have to do:

def changevalue():
for key in mytest.keys():
currentparam = mytest[key]
param1 = currentparam.param1
param2 = currentparam.param2
param3 = currentparam.param3
param3 = "newvalue"
mytest[key] = Test(param1, param2, param3)

If there's an easier way to accomplish this that I'm missing, that'd
be great!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Modifying Class Object

2010-02-07 Thread T
On Feb 7, 8:16 pm, Chris Rebert  wrote:
> On Sun, Feb 7, 2010 at 5:05 PM, T  wrote:
> > Ok, just looking for a sanity check here, or maybe something I'm
> > missing.  I have a class Test, for example:
>
> > class Test:
> >    def __init__(self, param1, param2, param3):
> >        self.param1 = param1
> >        self.param2 = param2
> >        self.param3 = param3
>
> > Next, I have a dictionary mytest that contains instances of Test.  If
> > I want to modify one of the Test instances within my dictionary, I
> > have to rewrite the entire entry, correct (since Python passes by
> > value, not reference)?
>
> Incorrect; Python uses neither. 
> Seehttp://effbot.org/zone/call-by-object.htmfor a excellent explanation
> of what Python does use.
>
> > I.e. if I wish to change just param3 of an
> > instance, I would have to do:
>
> > def changevalue():
> >    for key in mytest.keys():
> >        currentparam = mytest[key]
> >        param1 = currentparam.param1
> >        param2 = currentparam.param2
> >        param3 = currentparam.param3
> >        param3 = "newvalue"
> >        mytest[key] = Test(param1, param2, param3)
>
> > If there's an easier way to accomplish this that I'm missing, that'd
> > be great!
>
> def changevalue():
>     for test in mytest.values():
>         test.param3 = "newvalue"
>
> Cheers,
> Chris
> --http://blog.rebertia.com

Thanks so much - this makes life a lot easier!  And a great reference
as well.

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


Re: Modifying Class Object

2010-02-07 Thread T
Oops, this one was my fault - the object I was having the issues with
was actually a shelve file, not a dictionary..so just re-assigning the
variable isn't working, but re-writing the object to the shelve file
does.  So in this case, is there any way to just change a single
value, or am I stuck rewriting the entry?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Executing Commands From Windows Service

2010-02-08 Thread T
Thanks for the suggestions -  I think my next step is to try running
it under an admin user account, as you guys both mentioned.  Alf -
you're absolutely right, Microsoft has srvany.exe, which allows you to
run any EXE as a Windows service.  I've done this in the past, but
it's more of a "hack"..so this go around (since I will be distributing
this program), I wanted to go the more professional route..which,
unfortunately, involves learning the "scum". :)  I  posted this to
comp.os.ms-windows.programmer.win32, so we'll see if what the Win32
programmers have to say as well.  Thanks again!

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


Re: Executing Commands From Windows Service

2010-02-08 Thread T
On Feb 8, 1:28 am, Sean DiZazzo  wrote:
> On Feb 7, 4:57 pm, T  wrote:
>
> > Thanks for the suggestions -  I think my next step is to try running
> > it under an admin user account, as you guys both mentioned.  Alf -
> > you're absolutely right, Microsoft has srvany.exe, which allows you to
> > run any EXE as a Windows service.  I've done this in the past, but
> > it's more of a "hack"..so this go around (since I will be distributing
> > this program), I wanted to go the more professional route..which,
> > unfortunately, involves learning the "scum". :)  I  posted this to
> > comp.os.ms-windows.programmer.win32, so we'll see if what the Win32
> > programmers have to say as well.  Thanks again!
>
> I use windows services and they are very reliable.  I would say though
> that relying on plink.exe is much less reliable than either python or
> the service that it is running under.
>
> Why not take a look at paramiko as the ssh client library?  I think it
> runs under windows.  Also perhaps Twisted has something.  Either way
> would be light years ahead of using subprocess with plink.
>
> Just my thoughts.
>
> ~Sean

I totally agree that it would be much more reliable to use a Python
library for SSH - however, the program will need to execute other
external binaries as well.  So my goal at this point is to track down
_why_ it's failing when running as a service.  The actual command is
as follows:

C:\plink.exe -R :127.0.0.1:2020 -batch -i C:\keyfile.ppk
u...@10.10.10.1

I tried having subprocess.Popen run plink.exe by itself and piping
output to file, and this worked - so I know it's at least executing
plink.exe.  Sorry, I realize this isn't truly just a Python-related
question, but any help would be greatly appreciated!  So far no help
at comp.os.ms-windows.programmer.win32..
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Modifying Class Object

2010-02-08 Thread T
On Feb 8, 4:00 am, Duncan Booth  wrote:
> T  wrote:
> > Oops, this one was my fault - the object I was having the issues with
> > was actually a shelve file, not a dictionary..so just re-assigning the
> > variable isn't working, but re-writing the object to the shelve file
> > does.  So in this case, is there any way to just change a single
> > value, or am I stuck rewriting the entry?
>
> Either open the shelve with writeback=True or rewrite the entry.
> Rewriting the entry isn't hard: you can just re-use the same value:
>
> def changevalue():
>     for key in mytest.keys():
>         temp = mytest[key]
>         temp.param3 = "newvalue"
>         mytest[key] = temp
>
> If you really are changing every item in the shelve using writeback=True
> will be much simpler, but if you are only changing a few then just tell the
> shelve that you've updated them as above.
>
> --
> Duncan Boothhttp://kupuguy.blogspot.com


Duncan - Thanks for your help.  So each of the shelve entries I'm
modifying look something like this:  myshelve[key] =
TestClassObject(param1, param2, param3, param4, param5, etc.).  In
this case, with quite a few parameters, would you suggest setting
writeback=True and just modifying the needed value, or rewriting the
entire entry?  I have to admit the writeback option looks good, and if
the TestClassObject format ever changes (i.e. if I ever change the
order of the params), this particular function will be unchanged.
However, I don't know what the performance hit would be in using it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Executing Commands From Windows Service

2010-02-09 Thread T
On Feb 8, 2:25 pm, David Bolen  wrote:
> T  writes:
> > I have a script, which runs as a Windows service under the LocalSystem
> > account, that I wish to have execute some commands.  Specifically, the
> > program will call plink.exe to create a reverse SSH tunnel.  Right now
> > I'm using subprocess.Popen to do so.  When I run it interactively via
> > an admin account, all is well.  However, when I'm running it via
> > service, no luck.  I'm assuming this is to do with the fact that it's
> > trying to run under the LocalSystem account, which is failing.  What
> > would be the best way around this?  Thanks!
>
> The LocalSystem account is not, if I recall correctly, permitted to
> access the network.
>
> You'll have to install the service to run under some other account that
> has appropriate access to the network.
>
> -- David

The more testing I do, I think you may be right..I was able to get it
to work under a local admin account, and it worked under debug mode
(which would also have been running as this user).  I'm a bit
surprised though - I was under the assumption that LocalSystem had
rights to access the network?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Executing Commands From Windows Service

2010-02-10 Thread T
On Feb 9, 4:25 pm, David Bolen  wrote:
> David Bolen  writes:
> > Not from my past experience - the system account (LocalSystem for
> > services) can be surprising, in that it's pretty much unlimited access
> > to all local resources, but severely limited in a handful of cases,
> > one of which is any attempt to access the network.  I can't recall for
> > sure if it's an absolute block, or if in some cases you can configure
> > around it (e.g., it might use a null session for remote shares which
> > can be enabled through the registry on the target machine).  I've
> > basically stuck "LocalSystem = no network" in my head from past
> > experience.
>
> Given it's been a few years, I decided to try some tests, and the
> above is too simplistic.
>
> The LocalSystem account runs without any local Windows credentials
> (e.g., not like a logged in user), which has several consequences.
> One is that you can't access any network resources that require such
> credentials (like shares).  However, there's no sort of firewall
> filtering or anything, so plain old TCP/IP connections are fine.
> Unless, of course, the client being used also has other needs for
> local Windows credentials, independent or as a pre-requisite to the
> network operations.
>
> So backing up a bit, the TCP/IP connection that plink is making is not
> inherently disabled by running under LocalSystem, but it's certainly
> possible that plink is trying to identify the user under which it is
> operating to perhaps identify ssh keys or other local resources it
> needs to operate.  You might be able to cover this with command line
> options (e.g., plink supports "-i" to specify a key file to use), but
> you'll also need to ensure that the file you are referencing is
> readable by the LocalSystem account.
>
> One of the other responders had a very good point about locating plink
> in the first place too.  Services run beneath an environment that is
> inherited from the service control manager process, and won't include
> various settings that are applied to your user when logged in,
> especially things like local path changes, and working directories.
> Should you change the system path (via the environment settings),
> you'll need to reboot for the service control manager to notice - I
> don't think you can restart it without a reboot.
>
> So it's generally safer to be very clear, and absolute when possible,
> in a service for paths to external resources.
>
> The prior advice of running the service as an identified user (e.g.,
> with local credentials) is still good as it does remove most of these
> issues since if you can run the script manually under that user you
> know it'll work under service.  But it's not a hard requirement.
>
> If your script is dying such that a top level exception is being
> raised you should be able to find it in the application event log.  So
> that might give further information on what about the different
> environment is problematic.
>
> You can also use the win32traceutil module to help with grabbing debug
> output on the fly.  Import the module in your service, which will
> implicitly redirect stdout/stderr to a trace buffer.  Run the same
> win32traceutil module from the command line in another window.  Then
> start the service.  Any stdout/stderr will be reflected in the other
> window.  Can't catch everything (suppressed exceptions, or I/O that
> doesn't flow through the script's stdout/stderr), but again might help
> point in the right direction.
>
> -- David

Great suggestions once again - I did verify that it was at least
running the plink.exe binary when under LocalSystem by having the
service run "plink.exe > C:\plinkoutput.txt" - this worked fine.  And,
as I mentioned, it's now working just fine when running under a
regular admin account.  So, I think that's going to be my solution to
avoid any further issues.  My best guess at this point (as you
mentioned), is that plink.exe is doing _something_ network-related
that LocalSystem doesn't have the privileges to do - what exactly it
is, I have no idea.  I may play around with it some more later, but
running the service under an admin account should be a perfectly
acceptable solution.

Also, I will be writing other Python apps that the service will be
executing - so it goes without saying that I'll be including a log to
file option :)  Thanks again for all your guys' help!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Executing Commands From Windows Service

2010-02-12 Thread T
On Feb 11, 4:10 am, Tim Golden  wrote:
> On 10/02/2010 22:55, T wrote:
>
> > Great suggestions once again - I did verify that it was at least
> > running the plink.exe binary when under LocalSystem by having the
> > service run "plink.exe>  C:\plinkoutput.txt" - this worked fine.  And,
> > as I mentioned, it's now working just fine when running under a
> > regular admin account.  So, I think that's going to be my solution to
> > avoid any further issues.  My best guess at this point (as you
> > mentioned), is that plink.exe is doing _something_ network-related
> > that LocalSystem doesn't have the privileges to do - what exactly it
> > is, I have no idea.  I may play around with it some more later, but
> > running the service under an admin account should be a perfectly
> > acceptable solution.
>
> > Also, I will be writing other Python apps that the service will be
> > executing - so it goes without saying that I'll be including a log to
> > file option :)  Thanks again for all your guys' help!
>
> I'm not sure if this has been said already, but a reasonably common
> approach to services is to create a user specifically for the
> service and grant it exactly the privs / perms it needs (once you
> work out what they are). You then assign it a generated password,
> eg a GUID which you don't even try to remember: simply cut-and-paste
> it in. Then create the service to run under that user.
>
> That way you don't have the service running under
> some local Administrator account with the associated risk
> of its being subverted and gaining more control than you
> want. Nor do you have it running as a real user whose
> password might change for any reason, leaving you with
> a service which won't start up.
>
> I don't remember at this moment whether such a user's profile
> is automatically loaded in the process when the service starts
> or whether you have to do the LoadUserProfile thing.
>
> TJG

Tim - thanks, that's the route I'm going to go.  I've created separate
accounts for services before, and there's no question that's what I
have to do in this case. I'm still having some issues running some
commands (such as one that takes a screenshot), even as an admin user,
but I think this is more due to the fact that it's trying to interact
with the Desktop..so there may be no good solution.

Btw great site..can't tell you how many times I've gone back to it.
Keep up the great work!

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


Re: Executing Commands From Windows Service

2010-02-12 Thread T
On Feb 11, 8:21 am, "Martin P. Hellwig" 
wrote:
> On 02/07/10 19:02, T wrote:
>
> > I have a script, which runs as a Windows service under the LocalSystem
> > account, that I wish to have execute some commands.  Specifically, the
> > program will call plink.exe to create a reverse SSH tunnel.  Right now
> > I'm using subprocess.Popen to do so.  When I run it interactively via
> > an admin account, all is well.  However, when I'm running it via
> > service, no luck.  I'm assuming this is to do with the fact that it's
> > trying to run under the LocalSystem account, which is failing.  What
> > would be the best way around this?  Thanks!
>
> All being said about LS account not having the appropriate rights to
> access the necessary devices/files.
>
> Could it be so simple that the network is plain simply not available at
> all? For wireless connections I believe the connection/authentication by
> default is made in user space. I would save the output of an ipconfig
> run as the LS account to a file and see what is happening.
> Perhaps followed by a ping.
>
> --
> mph

Martin - another part of the program sends an email back to a
specified user, and that works, so LocalSystem must at least have some
network access.  From the testing I've done so far, seems like there's
just some grey area (which I haven't completely figured out yet) of
network-related tasks that LS just can't do.  I'd love to know what
this is, but so far the solution I have is just to create another user
and have the service use that..
-- 
http://mail.python.org/mailman/listinfo/python-list


Upgrading Py2exe App

2010-02-18 Thread T
I have a Python app which I converted to an EXE (all files separate;
single EXE didn't work properly) via py2exe - I plan on distributing
this and would like the ability to remotely upgrade the program (for
example, via HTTP/HTTPS).   Looks like it's not just the EXE that I
will need need to replace (DLLs, the library.zip, etc.).  What would
be the best way to go about doing this?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Upgrading Py2exe App

2010-02-19 Thread T
On Feb 18, 7:19 pm, Ryan Kelly  wrote:
> On Thu, 2010-02-18 at 07:46 -0800, T wrote:
> > I have a Python app which I converted to an EXE (all files separate;
> > single EXE didn't work properly) via py2exe - I plan on distributing
> > this and would like the ability to remotely upgrade the program (for
> > example, via HTTP/HTTPS).   Looks like it's not just the EXE that I
> > will need need to replace (DLLs, the library.zip, etc.).  What would
> > be the best way to go about doing this?
>
> I've been working on an auto-update framework for my own frozen apps,
> you might find it useful:
>
>  http://pypi.python.org/pypi/esky
>
> Docs are a little scarce at the moment, the next release will hopefully
> come with a short tutorial (as well as support for cx_freeze and maybe
> py2app, depending on how adventurous I'm feeling).
>
>   Cheers,
>
>      Ryan
>
> --
> Ryan Kellyhttp://www.rfk.id.au |  This message is digitally signed. Please 
> visit
> r...@rfk.id.au        |  http://www.rfk.id.au/ramblings/gpg/for details
>
>  signature.asc
> < 1KViewDownload

Thanks Ryan..this looks like it could be what I'm looking for, but I'm
still a bit unsure of how exactly how it works.  Do you happen to have
an idea approx when the next release w/ tutorial will be out?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Upgrading Py2exe App

2010-02-20 Thread T
On Feb 19, 4:32 pm, Ryan Kelly  wrote:
> On Fri, 2010-02-19 at 11:08 -0800, T wrote:
> > On Feb 18, 7:19 pm, Ryan Kelly  wrote:
> > > On Thu, 2010-02-18 at 07:46 -0800, T wrote:
> > > > I have a Python app which I converted to an EXE (all files separate;
> > > > single EXE didn't work properly) via py2exe - I plan on distributing
> > > > this and would like the ability to remotely upgrade the program (for
> > > > example, via HTTP/HTTPS).   Looks like it's not just the EXE that I
> > > > will need need to replace (DLLs, the library.zip, etc.).  What would
> > > > be the best way to go about doing this?
>
> > > I've been working on an auto-update framework for my own frozen apps,
> > > you might find it useful:
>
> > >  http://pypi.python.org/pypi/esky
>
> > > Docs are a little scarce at the moment, the next release will hopefully
> > > come with a short tutorial (as well as support for cx_freeze and maybe
> > > py2app, depending on how adventurous I'm feeling).
>
> > Thanks Ryan..this looks like it could be what I'm looking for, but I'm
> > still a bit unsure of how exactly how it works.  Do you happen to have
> > an idea approx when the next release w/ tutorial will be out?
>
> If I punt on the py2app support, I should be able to get it done in the
> next 3-4 days.  I'll send a quick email to python-list when it's ready.
>
> Here's a rough roadmap of where the project is heading:
>
>   v0.4.0:  cx_freeze support and a tutorial [the next 3-4 days]
>   v0.4.1:  py2app support [the next 2-3 weeks]
>   v0.5.0:  differential updates using bsdiff [next few months]
>
>   Cheers,
>
>      Ryan
>
> --
> Ryan Kellyhttp://www.rfk.id.au |  This message is digitally signed. Please 
> visit
> r...@rfk.id.au        |  http://www.rfk.id.au/ramblings/gpg/for details
>
>  signature.asc
> < 1KViewDownload

Excellent - I look forward to giving it a try.  Thanks again!
-- 
http://mail.python.org/mailman/listinfo/python-list


Py2exe - Bad File Descriptor

2010-02-28 Thread T
I have a Python script, which is a Windows Service, that I created an
EXE of via py2exe.  As part of the program, it calls some external
binaries, one of which restarts the computer.  When I'm logged in,
this works fine.  However, if I log out, the service stops and logs
the following error in the Event Log:

:(9, 'Bad file descriptor')

Anyone have an idea what could be causing this?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Py2exe - Bad File Descriptor

2010-02-28 Thread T
On Feb 28, 3:48 pm, Dennis Lee Bieber  wrote:
> On Sun, 28 Feb 2010 10:35:23 -0800 (PST), T 
> declaimed the following in gmane.comp.python.general:
>
> > I have a Python script, which is a Windows Service, that I created an
> > EXE of via py2exe.  As part of the program, it calls some external
> > binaries, one of which restarts the computer.  When I'm logged in,
> > this works fine.  However, if I log out, the service stops and logs
> > the following error in the Event Log:
>
> > :(9, 'Bad file descriptor')
>
> > Anyone have an idea what could be causing this?
>
>         Without code, one must play psychic... And I haven't dusted off the
> Tarot cards, I Ching coins, and Crystal balls is some time (No, I don't
> have a ouija board)...
>
>         Could it be you have a mapped drive that gets disconnected when you
> log off?
>
>         Is the service being started as part of your login?
>
>         Does it attempt to write to a console?
> --
>         Wulfraed         Dennis Lee Bieber               KD6MOG
>         wlfr...@ix.netcom.com      HTTP://wlfraed.home.netcom.com/

Sorry for the lack of code - yes, it does try to write to the
console.  From what I'm finding, this error may be due to the fact
that there is no "console" to write to when I'm logged off.  However,
I would like to be able to print to screen if I run the EXE in debug
mode (i.e. "myservice.exe debug").  Do you know of any way around
this?  Also, I need to get the output generated from an external EXE -
will subprocess.Popen cause problems if I use stdout=PIPE?  Thanks for
your help!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Py2exe - Bad File Descriptor

2010-03-01 Thread T
On Feb 28, 10:00 pm, Dennis Lee Bieber  wrote:
> On Sun, 28 Feb 2010 13:22:19 -0800 (PST), T 
> declaimed the following in gmane.comp.python.general:
>
> > Sorry for the lack of code - yes, it does try to write to the
> > console.  From what I'm finding, this error may be due to the fact
> > that there is no "console" to write to when I'm logged off.  However,
> > I would like to be able to print to screen if I run the EXE in debug
> > mode (i.e. "myservice.exe debug").  Do you know of any way around
> > this?  Also, I need to get the output generated from an external EXE -
> > will subprocess.Popen cause problems if I use stdout=PIPE?  Thanks for
> > your help!
>
>         True services typically don't have interactive (console) type I/O...
> What is more likely to work is to have an open socket waiting for
> connections, and the use of a separate user-space client that connects
> to the socket...
> --
>         Wulfraed         Dennis Lee Bieber               KD6MOG
>         wlfr...@ix.netcom.com      HTTP://wlfraed.home.netcom.com/

So how would that work..would the program buffer all the "print"
output, then send it to the client when it connects?  Do you happen to
know of any available code that utilizes this method, or something
similar?  Thanks for your help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Parsing Email Headers

2010-03-11 Thread T
All I'm looking to do is to download messages from a POP account and
retrieve the sender and subject from their headers.  Right now I'm 95%
of the way there, except I can't seem to figure out how to *just* get
the headers.  Problem is, certain email clients also include headers
in the message body (i.e. if you're replying to a message), and these
are all picked up as additional senders/subjects.  So, I want to avoid
processing anything from the message body.

Here's a sample of what I have:

# For each line in message
for j in M.retr(i+1)[1]:
# Create email message object from returned string
emailMessage = email.message_from_string(j)
# Get fields
fields = emailMessage.keys()
# If email contains "From" field
if emailMessage.has_key("From"):
# Get contents of From field
from_field = emailMessage.__getitem__("From")

I also tried using the following, but got the same results:
 emailMessage =
email.Parser.HeaderParser().parsestr(j, headersonly=True)

Any help would be appreciated!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parsing Email Headers

2010-03-11 Thread T
On Mar 11, 3:13 pm, MRAB  wrote:
> T wrote:
> > All I'm looking to do is to download messages from a POP account and
> > retrieve the sender and subject from their headers.  Right now I'm 95%
> > of the way there, except I can't seem to figure out how to *just* get
> > the headers.  Problem is, certain email clients also include headers
> > in the message body (i.e. if you're replying to a message), and these
> > are all picked up as additional senders/subjects.  So, I want to avoid
> > processing anything from the message body.
>
> > Here's a sample of what I have:
>
> >                 # For each line in message
> >                 for j in M.retr(i+1)[1]:
> >                     # Create email message object from returned string
> >                     emailMessage = email.message_from_string(j)
> >                     # Get fields
> >                     fields = emailMessage.keys()
> >                     # If email contains "From" field
> >                     if emailMessage.has_key("From"):
> >                         # Get contents of From field
> >                         from_field = emailMessage.__getitem__("From")
>
> > I also tried using the following, but got the same results:
> >                  emailMessage =
> > email.Parser.HeaderParser().parsestr(j, headersonly=True)
>
> > Any help would be appreciated!
>
> If you're using poplib then use ".top" instead of ".retr".

I'm still having the same issue, even with .top.  Am I missing
something?

for j in M.top(i+1, 0)[1]:
emailMessage = email.message_from_string(j)
#emailMessage =
email.Parser.HeaderParser().parsestr(j, headersonly=True)
# Get fields
fields = emailMessage.keys()
# If email contains "From" field
if emailMessage.has_key("From"):
# Get contents of From field
from_field = emailMessage.__getitem__("From")

Is there another way I should be using to retrieve only the headers
(not those in the body)?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parsing Email Headers

2010-03-11 Thread T
Thanks for your suggestions!  Here's what seems to be working - it's
basically the same thing I originally had, but first checks to see if
the line is blank

response, lines, bytes = M.retr(i+1)
# For each line in message
for line in lines:
if not line.strip():
M.dele(i+1)
break

emailMessage = email.message_from_string(line)
# Get fields
fields = emailMessage.keys()
# If email contains "From" field
if emailMessage.has_key("From"):
# Get contents of From field
from_field = emailMessage.__getitem__("From")
-- 
http://mail.python.org/mailman/listinfo/python-list


re.search when used within an if/else fails

2012-11-19 Thread Kevin T
python version 2.4.3, yes i know that it is old.  getting the sysadmin to 
update the OS requires a first born.

with the following code..
for signal in register['signals'] :

351   sigName = signal['functionName']
352   if re.search( "rsrvd", sigName ) == None :
353  print sigName
354  newVal = "%s%s" % ( '1'*signal['bits'] , newVal ) 
#prepend 0's
355   if re.search( "rsrvd", sigName ) != None :
356  print sigName
357  newVal = "%s%s" % ( '0'*signal['bits'], newVal )

regardless of how i code line 352, i can not EVER use an else clause with it.  
if i use an else clause, the else will NEVER get executed...

has any one experienced anything like this behavior?  any suggestions?  the 
above code works but... why should i have to code it like this?

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


Re: re.search when used within an if/else fails

2012-11-20 Thread Kevin T
On Monday, November 19, 2012 7:29:20 PM UTC-6, Steven D'Aprano wrote:
> On Tue, 20 Nov 2012 01:24:54 +, Steven D'Aprano wrote:
> 
> 
> 
> - use "if something is None", not == None.
> 
> 
> Steven

i will not include line #'s in the future, point taken
i will change ==/!= to is/is not as most people pointed out.

there is no else because it doesn't work.

i used eclipse in debug mode and a command line execution of the code, both 
behave the same way

#if re.search( "rsrvd", sigName ) :   #version a
#if re.search( "rsrvd", sigName ) == None :   #version b
if re.search( "rsrvd", sigName ) is None :   #version bb
   print sigName 
   newVal = "%s%s" % ('1'*signal['bits'] , newVal ) 
#else: #version c
if re.search( "rsrvd", sigName ) != None :   #version d
   print sigName 
   newVal = "%s%s" % ( '0'*signal['bits'],> newVal ) 

i can use either version a/b the else clause (version c) will not execute.
fortunately,  with version bb, the else clause will execute!!  

thanks for the input all..

kevin

Now if i change
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: re.search when used within an if/else fails

2012-11-21 Thread Kevin T
On Nov 20, 1:37 pm, Ian Kelly  wrote:
> On Tue, Nov 20, 2012 at 12:09 PM, Kevin T  wrote:
> > #if re.search( "rsrvd", sigName ) :   #version a
> > #if re.search( "rsrvd", sigName ) == None :   #version b
> > if re.search( "rsrvd", sigName ) is None :   #version bb
> >    print sigName
> >    newVal = "%s%s" % ('1'*signal['bits'] , newVal )
> > #else:                                 #version c
> > if re.search( "rsrvd", sigName ) != None :   #version d
> >    print sigName
> >    newVal = "%s%s" % ( '0'*signal['bits'],> newVal )
>
> > i can use either version a/b the else clause (version c) will not execute.
> > fortunately,  with version bb, the else clause will execute!!
>
> There must be some other difference in your testing.  I don't have
> Python 2.4 available, but I tried your version a in both Python 2.3
> and 2.5 using made-up values for sigName, and the else clause is
> executed in both.

I went back and tried version a again, blam it is/does work now ?!?!?
I am not sure what changed but version a was the original code that
wouldn't work.  All the examples i had read, showed version a as a
working version.  I spent significant time trying version a with
parens, spacing changes, different regex values to no avail.  hence
the creation of all the other versions.

thanks for your help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: re.search when used within an if/else fails

2012-11-28 Thread Kevin T
I agree. Being relatively new to python, i was not sure of quirks so i posted 
the original code.  

I did find the real issue, as I found another loop that was not being executed 
properly.

It turns out that if the indent started with spaces and ended with tabs, 
neither eclipse or command line execution would complain.  where as if the 
indent begins with tabs and has spaces in the middle the tools will complain of 
indentation issues.

i have found that the vi plugin for python is the culprit here.  when the 
plugin does block indentation, the result is indents that begin with spaces.  
if i disable the vi plugin and use the regular eclipse editor these issues go 
away.

with other languages i always expand tabs to spaces.  the vi plugin does do 
this properly.  if i change all indents to be spaces only will python behave?  
i inherited a good deal of the code that i am using, which is tab based.

thanks kevin


On Wednesday, November 21, 2012 11:00:50 PM UTC-6, Chris Angelico wrote:
> On Thu, Nov 22, 2012 at 3:41 AM, Kevin T  wrote:
> 
> > I went back and tried version a again, blam it is/does work now ?!?!?
> 

> 
> 
> This is why the Short, Self-Contained, Correct Example is so
> 
> important. See http://sscce.org/ for some info on that. I often find
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


dynamically creating classes from text

2012-01-24 Thread T H
I’m new to python, sorry if my question is a bit naive, I was
wondering if it is possible to parse some text (ie. from a text file
or say html) and then dynamically create a class?

for example lets say the contents of the text file is:

 functionName: bark  arg1: numberBarks
 functionName: runarg1: howFast  arg2: howLong

and then from the text dynamically create a class like the one below
(including the functions and its implementation)

class Dog:
def bark(self, numberBarks, myArg):
print(‘numberBarks: ‘ + numberBarks)
print(‘myArg’ + myArg)
return
def run(self, howFast, howLong, myArg):
print(‘howFast: ‘ + howFast)
print(‘howLong’ + howLong)
print(‘myArg’ + myArg)
return

I know my question is a bit far fetched. Anyhow if it is possible how
is it done?
Thanks so much for any help!
-- 
http://mail.python.org/mailman/listinfo/python-list


controlling Python script with usb midi controller tia sal22

2011-06-30 Thread Rick T
Greetings All

I have a usb midi controller (uc-33e) and I have a working python
script see below. I would like to be able to control the variables of
the python script using my usb controller does anyone have an example
of this? I would like to use the "midi learn" function to
automatically map a midi control to an object (like in Ardour which is
a music program for linux) by ctrl-middle clicking the object and just
turning the control on the usb midi controller to map it. But I'm also
willing to hard code the midi CC into the python script if needed.

I'm using linux 64bit ubuntu

here's a link to the code below:
http://stackoverflow.com/questions/6524089/controlling-python-script-with-usb-midi-controller
-- 
http://mail.python.org/mailman/listinfo/python-list


Why do class methods always need 'self' as the first parameter?

2011-08-31 Thread T. Goodchild
I’m new to Python, and I love it.  The philosophy of the language (and
of the community as a whole) is beautiful to me.

But one of the things that bugs me is the requirement that all class
methods have 'self' as their first parameter.  On a gut level, to me
this seems to be at odds with Python’s dedication to simplicity.

For example, consider Python’s indent-sensitive syntax.  Although
other languages didn’t use indentation to specify scope, programmers
always used indentation anyways.  Making indentation took a common
practice, made it a rule, and the result was a significantly improved
signal-to-noise ratio in the readability of Python code.

So why is 'self' necessary on class methods?  It seems to me that the
most common practice is that class methods *almost always* operate on
the instance that called them.  It would make more sense to me if this
was assumed by default, and for "static" methods (methods that are
part of a class, but never associated with a specific instance) to be
labelled instead.

Just curious about the rationale behind this part of the language.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numerical representation

2011-03-07 Thread Katie T
The main choices for arbitrary point precision seem to be mpmath (which is
pure python) and GMP (C++ but with python wrapper; GMP is heavily used in
academia)

Links:

http://code.google.com/p/mpmath/

http://gmpy.sourceforge.net/

Katie
-- 
CoderStack
http://www.coderstack.co.uk
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: possible to run a python script without installing python?

2011-03-15 Thread Katie T
On Tue, Mar 15, 2011 at 8:58 PM, davidj411  wrote:

> it seems that if I copy the python.exe binary and the folders
> associated with it to a server without python, i can run python.
> does anyone know which files are important to copy and which can be
> omitted?
>
> i know about py2exe and have had no luck with it.


What's the reason for wanting to avoid installing Python? - are you just
trying to save disk space?

If it's a case of not having admin rights, you can just copy the Python
directory, I don't believe it has any dependencies anywhere else.

Katie
-- 
CoderStack
http://www.coderstack.co.uk
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-18 Thread Katie T
What sort of checks are you making ?  - in general greater than/less than
tend to be fairly optimal, although you might be able to do a faster "is
negative" test

Katie

On Fri, Mar 18, 2011 at 2:24 PM, Martin De Kauwe  wrote:

> Hi,
>
> if one has a set of values which should never step outside certain
> bounds (for example if the values were negative then they wouldn't be
> physically meaningful) is there a nice way to bounds check? I
> potentially have 10 or so values I would like to check at the end of
> each iteration. However as the loop is over many years I figured I
> probably want to be as optimal as possible with my check. Any
> thoughts?
>
> e.g. this is my solution
>
> # module contain data
> # e.g. print state.something might produce 4.0
> import state as state
>
> def main():
>for i in xrange(num_days):
># do stuff
>
># bounds check at end of iteration
>bounds_check(state)
>
>
> def bounds_check(state):
>""" check state values are > 0 """
>for attr in dir(state):
>if not attr.startswith('__') and getattr(state, attr) < 0.0:
>print "Error state values < 0: %s" % (attr)
>sys.exit()
>
> if __name__ == "__main__":
>sys.exit(main())
>
> thanks
>
> Martin
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
CoderStack
http://www.coderstack.co.uk/python-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-18 Thread Katie T
On Fri, Mar 18, 2011 at 3:01 PM, Jean-Michel Pichavant <
jeanmic...@sequans.com> wrote:
>
> Don't check for bounds, fix any bug in the code that would set your values
> out of bounds and use asserts while debugging.
>
> Otherwise if you really need dynamic checks, it will cost you cpu, for
> sure. Howeverver you could for instance override the __setatttr__ of state
> object, and call the attribute's associated function.
>

If the codes something critical (i.e. it's used for financial calculations,
hardware control, etc.) it's probably safer to test it dynamically, unless
you only have a finite number of inputs/outputs it's often hard to ensure
you've fixed all the bugs.

Katie
-- 
CoderStack
h ttp://www.coderstack.co.uk/perl-jobs
The Software Developer Job Board
-- 
http://mail.python.org/mailman/listinfo/python-list


Want to write a python code for sending and receiving frames over wifi/wlan0 using python

2017-10-12 Thread T Obulesu
Hello all, I want to send some frames defined by me{Example, [0x45,0x43,0x32]} 
to the raspberry pi from any macine(Desktop/Laptop/other raspberry pi). But I 
want to send those frames over wifi or use wlan0 using python Any suggestions?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Want to write a python code for sending and receiving frames over wifi/wlan0 using python

2017-10-12 Thread T Obulesu
On Thursday, 12 October 2017 13:38:55 UTC+5:30, T Obulesu  wrote:
> Hello all, I want to send some frames defined by me{Example, 
> [0x45,0x43,0x32]} to the raspberry pi from any macine(Desktop/Laptop/other 
> raspberry pi). But I want to send those frames over wifi or use wlan0 using 
> python Any suggestions?



Yes..
Actully we are sending and receiving ZigBee frames through the serial port.
But I want to do the same thing through the Ethernet port/ Wlan0 port rather 
serial port.

My Zigbee Frame Format looks like this:

0x7EA88X00S8899800131A2000


My setup is as follows:
My raspberry pi and my laptop both are connected to the same WiFi and ports are 
wlan0.
And it can be directly connected to the laptop using Ethernet cable. If this is 
the case, I wnat to change the port  to the eth0 and send the packets
-- 
https://mail.python.org/mailman/listinfo/python-list


Sockets but calling from different programs

2017-10-23 Thread T Obulesu
I'm new to python3 and scratching my head to write a program for this logic:

classA.py
Class A:
  # class for socket communication
  basic init method that initializes port, address, connection

 method send(message):
 # for sending any message through the given port


   method receive():
   # will be keep on listening for incoming messages



classB.py

Class B:
   import the send method from class A
   send the messages from this class


classC.py

Class C:
import the receive method from the class A
receive all the messages from the same socket from here.



Note:
 classA.py, classB.py, ClassC.py are saved in different locations.


Can someone help me in writing the code and how can I create a single object 
and use it in multiple classed?

This is how my code looks like:
import socket
import select

class ChatServer:

def __init__( self):
self.port = 8880;
self.srvsock = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
self.srvsock.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, 1 )
self.srvsock.bind( ("", 8880) )
self.srvsock.listen( 5 )
print("New socket bind")
while 1:
print("Waiting for new connection")
self.sock,(remhost,remport)=self.accept_new_connection()
print ('ChatServer started on port %s' % port)

def send(self,data):
self.sock.send(data)
def receieve(self):
self.str=sock.recv(1024)
print(self.str)


I want to run this code first time when my project starts and want to call 
send() and receive() functions from other two different python files located in 
different path.
  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Idle not giving my prompt after If line

2018-04-09 Thread T Berger
On Monday, April 9, 2018 at 1:34:04 PM UTC-4, Peter Otten wrote:
> brg...@gmail.com wrote:
> 
> > On Monday, April 9, 2018 at 3:08:28 AM UTC-4, Peter Otten wrote:
> >> brg...@gmail.com wrote:
> >> 
> >> > I typed the If part of an If/Else statement, but did not get a prompt
> >> > at the beginning of the next line when I hit return. Instead, the
> >> > cursor lined up under the "p" of "print." Here is the line of text
> >> > (it's part of a longer bit of coding, I copied out of a textbook).
> >> > 
> >>  if right_this_minute in odds:
> >> >print("This minute seems a little odd.")[Return]
> >> > 
> >> > You can't see it, but the cursor is blinking under the "p."
> >> > 
> >> > Why is this happening and what's the fix?
> >> > 
> >> > Thanks,
> >> > 
> >> > Tamara
> >> 
> >> It works as designed; the interpreter has no way of knowing whether you
> >> are about to write another line belonging to the if suite, like in
> >> 
> >> if foo:
> >>print("clearing foo")
> >>foo = False
> >> 
> >> That's why you have to hit  twice to trigger execution of the
> >> code.
> >> 
> >> By the way, when you copy (or write) a "longer bit" I recomend that you
> >> put the code into a py file so that you don't have to retype it when you
> >> want to make a small modification. Instead you can just hit F5 and see
> >> the effect of your changes.
> > 
> > Thanks, Peter, for your quick reply. But here's what happened. When I hit
> >  twice, the cursor did go back to the margin, but skipped two
> > lines before doing so. Then when I hit  after "else:" I got an
> > error message again. What did I do wrong? 
> 
> I'm sorry, I did not read your question carefully enough, and missed the 
> "else" part. Please read Terry's correction of my advice.
> 
> > Also, could you please tell me
> > how to create a py file. Thanks.
> 
> Choose "New File" in the "File" menu, then write your code in the window 
> that pops up, save with "Save" (pick a meaningful name that does not collide 
> with any name in Python's standard library) and finally run with "Run 
> Module" in the "Run" menu.

Thanks, Peter, for your help. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Idle not giving my prompt after If line

2018-04-09 Thread T Berger
On Monday, April 9, 2018 at 1:19:13 PM UTC-4, Terry Reedy wrote:
> On 4/9/2018 3:07 AM, Peter Otten wrote:
> > brg...@gmail.com wrote:
> > 
> >> I typed the If part of an If/Else statement, but did not get a prompt at
> >> the beginning of the next line when I hit return. Instead, the cursor
> >> lined up under the "p" of "print." Here is the line of text (it's part of
> >> a longer bit of coding, I copied out of a textbook).
> >>
> > if right_this_minute in odds:
> >> print("This minute seems a little odd.")[Return]
> >>
> >> You can't see it, but the cursor is blinking under the "p."
> >>
> >> Why is this happening and what's the fix?
> 
> > It works as designed; the interpreter has no way of knowing whether you are
> > about to write another line belonging to the if suite, like in
> > 
> > if foo:
> > print("clearing foo")
> > foo = False
> 
> To enter 'else', instead of another line under 'if', hit backspace.
> 
> > That's why you have to hit  twice to trigger execution of the code.
> 
> When you are done entering the complete multiline statement.
> 
> > By the way, when you copy (or write) a "longer bit" I recomend that you put
> > the code into a py file so that you don't have to retype it when you want to
> > make a small modification. Instead you can just hit F5 and see the effect of
> > your changes.
> 
> -- 
> Terry Jan Reedy

Thanks, Terry, for your help. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Filtering computer.lang.python

2018-04-09 Thread T Berger
This is the first time I've joined a google group and I don't understand the 
setup. Why are most of the posts in this group unrelated to python, and how do 
I filter this junk (sorry) out?
-- 
https://mail.python.org/mailman/listinfo/python-list


How to apply filters to posts

2018-04-09 Thread T Berger
This is the first time I've joined a google group and I don't understand the 
setup. Why are most of the posts in this group unrelated to python, and how do 
I filter this junk (sorry) out? 
-- 
https://mail.python.org/mailman/listinfo/python-list


Meaning of abbreviated terms

2018-05-05 Thread T Berger
What does the "p" in "plist" stand for?
Is there a python glossary that spells out the meanings of abbreviated terms?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Meaning of abbreviated terms

2018-05-10 Thread T Berger
On Saturday, May 5, 2018 at 6:45:46 PM UTC-4, MRAB wrote:
> On 2018-05-05 17:57, T Berger wrote:
> > What does the "p" in "plist" stand for?
> > Is there a python glossary that spells out the meanings of abbreviated 
> > terms?
> > 
> "plist" is "property list". It's listed in the Python documentation.

Thanks for the answer. Missed it till now.
-- 
https://mail.python.org/mailman/listinfo/python-list


Learning Python

2018-06-05 Thread T Berger
Can someone learn Python through a book such as Head Start Python? Would an 
online course from MIT or google be better? 
-- 
https://mail.python.org/mailman/listinfo/python-list


Problem finding my folder via terminal

2018-06-06 Thread T Berger
I’m learning Python on my own and have been stuck for two days trying to get 
modules I created into site-packages. As a trial step, we were asked to change 
directly into the folder containing our modules. I typed “cd mymodules” per 
instructions, but got this error message: “-bash: cd: mymodules: No such file 
or directory.” I saved mymodules to my documents. What is going wrong here?

When I tried to create a distribution file, I typed “192:~ TamaraB$ mymodules$ 
python3 setup.py sdist.” I got this error message: “-bash: mymodules$: command 
not found.” What should I do?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem finding my folder via terminal

2018-06-07 Thread T Berger
On Wednesday, June 6, 2018 at 12:19:35 PM UTC-4, T Berger wrote:
> I’m learning Python on my own and have been stuck for two days trying to get 
> modules I created into site-packages. As a trial step, we were asked to 
> change directly into the folder containing our modules. I typed “cd 
> mymodules” per instructions, but got this error message: “-bash: cd: 
> mymodules: No such file or directory.” I saved mymodules to my documents. 
> What is going wrong here?
> 
> When I tried to create a distribution file, I typed “192:~ TamaraB$ 
> mymodules$ python3 setup.py sdist.” I got this error message: “-bash: 
> mymodules$: command not found.” What should I do?

~
To answer your questions in order:
  “Who asked you to do that?”
I’m teaching myself python with the book, Head First Python. In the exercise 
I’m having trouble with, we’re supposed to install a module we created into 
site-packages. 
 “We'll need some more information about the computer you are using: what OS 
are you using (Mac, Linux, Windows, something else), what shell are you using, 
perhaps a file listing of your home directory. “
I’m using Terminal in Mac Sierra (10.12.6).
“(I'm not sure what the 192 part means. Does that increase each time you type a 
command?) “
I new to Terminal, but that 192 looked weird to me too. It doesn’t increase, 
just stays at 192. There is also a thin gray left bracket in front of the “192” 
which didn’t copy into my email. Is there some way to restore the default 
prompt in Terminal? What is the default prompt?
Back to my problem. Your email helped me get into the mymodules folder, but I’m 
still stuck at the next step of the exercise I’m working on, which is to 
getting the module I created into site-packages. The folder, mymodules, 
contains three files: the module we created, a setup file (setup.py), and a 
readme file. The line of text we were instructed to type into our terminal was: 
“python3 setup.py sdist.” In response, I got this error message: 
“/Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python:
 can't open file 'setup.py': [Errno 2] No such file or directory”.  What is 
going wrong here? 
Thanks to any replies
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem finding my folder via terminal

2018-06-07 Thread T Berger
On Wednesday, June 6, 2018 at 12:19:35 PM UTC-4, T Berger wrote:
> I’m learning Python on my own and have been stuck for two days trying to get 
> modules I created into site-packages. As a trial step, we were asked to 
> change directly into the folder containing our modules. I typed “cd 
> mymodules” per instructions, but got this error message: “-bash: cd: 
> mymodules: No such file or directory.” I saved mymodules to my documents. 
> What is going wrong here?
> 
> When I tried to create a distribution file, I typed “192:~ TamaraB$ 
> mymodules$ python3 setup.py sdist.” I got this error message: “-bash: 
> mymodules$: command not found.” What should I do?


To answer your questions in order: 

  “Who asked you to do that?” 

I’m teaching myself python with the book, Head First Python. In the exercise 
I’m having trouble with, we’re supposed to install a module we created into 
site-packages. 

 “We'll need some more information about the computer you are using: what OS 
are you using (Mac, Linux, Windows, something else), what shell are you using, 
perhaps a file listing of your home directory. “ 

I’m using Terminal in Mac Sierra (10.12.6). 

“(I'm not sure what the 192 part means. Does that increase each time you type a 
command?) “ 

I'm new to Terminal, but that 192 looked weird to me too. It doesn’t increase, 
just stays at 192. There is also a thin gray left bracket in front of the “192” 
which didn’t copy into my email. Is there some way to restore the default 
prompt in Terminal (and what is the default prompt)? 

Back to my problem. Your email helped me get into the mymodules folder, but I’m 
still stuck at the next step of the exercise, which is to get the module I 
created into site-packages. mymodules contains three files: the module we 
created, a setup file (setup.py), and a readme file. The line of text we were 
instructed to type into our terminal was: “python3 setup.py sdist.” In 
response, I got this error message: 
“/Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python:
 can't open file 'setup.py': [Errno 2] No such file or directory”.  

Why is this not working for me?

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


Distribution file error

2018-06-08 Thread T Berger
Hi,

I really need help here.

I’m trying to create a distribution file for my module, but got an error 
message. The module, including the setup and read me files, are contained 
within the folder “mymodules.” I typed this command (per instructions from my 
workbook) from within mymodules folder:

192:~ TamaraB$ cd Desktop/mymodules/
192:mymodules TamaraB$ python3 setup.py sdist
/Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS/Python:
 can't open file 'setup.py': [Errno 2] No such file or directory.

Why is this not working?

(I’m working in the OS Sierra terminal.)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem finding my folder via terminal

2018-06-09 Thread T Berger
On Saturday, June 9, 2018 at 5:05:25 AM UTC-4, Cameron Simpson wrote:
> On 09Jun2018 02:37, Gene Heskett  wrote:
> >On Saturday 09 June 2018 01:36:17 Tamara Berger wrote:
> >> Re inline style: When I hit reply, this is the window I get.
> 
> The python-list server strips attachments, so I didn't get the screenshot you 
> may have attached. However...
> 
> >> I don't
> >> get my previous email with the carets appended to the beginning of the
> >> line.
> 
> I've just gone to my GMail and tried a reply. In my reply compose window 
> there 
> is a little button at the bottom left with three dots in it, thus: "[...]", 
> kind of. Click that, it expands to the prior quoted text. Then you can trim 
> it 
> and insert your responses.
> 
> >> Before I look at the rest of your email, I'd like for you to explain
> >> how there is a mymodule folder nested within another mymodule folder.
> >> I don't see this second folder in Finder, and I definitely didn't
> >> create it.
> >
> >Finder, if thats what you are using, I am not familiar with it, is
> >probably showing you that which it has cached, before that folder was
> >created.  Back out one layer and go back in so it actually reads a fresh
> >copy of that directory(folder).
> 
> The Finder uses MacOS' equivalent of Linux' inotify: its folder views are 
> "live" and update as soon as anything changes.
> 
> Tamara, there are things the Finder won't show, particularly "hidden" files, 
> which is an attribute you can assign to folders. Maybe that is what happened. 
>  
> I've got no concrete explaination, and I can't inspect your machine directly. 
>  
> Also, how sure are you that the "mymodules" in the Finder is the upper one 
> and 
> not the lower one? Just guessing here.
> 
> My opinion is that you did create it, but not realised how that happened.
> 
> All you'd need to do is something like this:
> 
>   cd Desktop
>   mkdir mymodules
>   cd mymodules
>   ... get distracted, do something else, come back much later ...
>   mkdir mymodules
>   cd mymodules
>   ... proceed to make the setup.py and so forth ...
> 
> i.e. just do it twice. Alternatively, and this is a common one, you got a 
> template archive, such as a zip file, containing an "empty" module to get you 
> started. And did something like this:
> 
>   cd Desktop
>   mkdir mymodules
>   cd mymodules
>   unzip the-empty-module-template.zip
> 
> If the zip file itself also contained a top level "mymodules" folder in it, 
> it 
> will have made the second "mymodules" inside the one you made.
> 
> Most archive files are set up to have their entire contents inside a single 
> top 
> folder, so this scenario isn't all that unlikely.
> 
> A third possibility is that you made a mymodules somewhere else (such as in 
> your top level home directory), and later decided to put it on your Desktop 
> to 
> make it easy to find/access. So you might have decided to "mv" your 
> "mymodules" 
> folder into the Desktop like this:
> 
>   mv mymodules Desktop/mymodules
> 
> which is fine. But mv has some interesting behaviour. If "mymodules" didn't 
> exist in Desktop, then youre "mymodules" will get moved into the Desktop.  
> However, if mv's final argument is an _existing_ directory, mv puts things 
> inside it. So if you went:
> 
>   mkdir Desktop/mymodules
>   mv mymodules Desktop/mymodules
> 
> then mv would put your top level "mymodules" _inside_ the "Desktop/mymodules" 
> folder that already exists, producing the structure you currently have.
> 
> Cheers,
> Cameron Simpson 

Hi Cameron,

I want to read your last two emails in the evening when I have more time to 
digest the information, but I have a quick question now. I made the correction 
you suggested to mymodule and went on to create a source distribution file. 
Then I got stuck again when trying to install my module into site-packages. I 
think I got a permission error. How do I fix this? Here is the coding from the 
shell:

Last login: Sat Jun  9 13:16:15 on ttys000
192:~ TamaraB$ cd Desktop/mymodules/dict
-bash: cd: Desktop/mymodules/dict: No such file or directory
192:~ TamaraB$ cd Desktop/mymodules/dist
192:dist TamaraB$ sudo python3 -m pop install vsearch-1.0.tar.gz
Password:

There is a symbol of a key after the word "Password."

Thanks, 

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


Re: Problem finding my folder via terminal

2018-06-09 Thread T Berger
On Saturday, June 9, 2018 at 3:30:39 PM UTC-4, MRAB wrote:
> On 2018-06-09 18:48, T Berger wrote:
> [snip]
> 
> > I want to read your last two emails in the evening when I have more time to 
> > digest the information, but I have a quick question now. I made the 
> > correction you suggested to mymodule and went on to create a source 
> > distribution file. Then I got stuck again when trying to install my module 
> > into site-packages. I think I got a permission error. How do I fix this? 
> > Here is the coding from the shell:
> > 
> > Last login: Sat Jun  9 13:16:15 on ttys000
> > 192:~ TamaraB$ cd Desktop/mymodules/dict
> > -bash: cd: Desktop/mymodules/dict: No such file or directory
> > 192:~ TamaraB$ cd Desktop/mymodules/dist
> > 192:dist TamaraB$ sudo python3 -m pop install vsearch-1.0.tar.gz
> > Password:
> > 
> > There is a symbol of a key after the word "Password."
> > 
> Did you really type "pop"? It looks that you're running the wrong code. 
> The module you want is "pip".

Hi Cameron,

Sorry. That's terrible. But I did run the code a number of times correctly. I 
just did it again and got the same key icon:

Last login: Sat Jun  9 13:26:14 on ttys000
192:~ TamaraB$ cd Desktop/mymodules/dist
192:dist TamaraB$ dist TamaraB$ sudo python3 -m pip install vsearch-1.0.tar.gz 
-bash: dist: command not found
192:dist TamaraB$ sudo python3 -m pip install vsearch-1.0.tar.gz
Password:

What next?

Thanks,

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


Posting warning message

2018-06-10 Thread T Berger
When I go to post a reply, I get a warning asking if I want my email address 
(or other email addresses listed) visible to all, and do I want to edit my 
post. What should I do?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Posting warning message

2018-06-10 Thread T Berger
Thanks, everyone, for your suggestions. I didn't respond to your posts earlier 
because I wasn't notified by email updates. I don't understand why they've 
stopped coming. I didn't change any settings.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Posting warning message

2018-06-11 Thread T Berger
On Monday, June 11, 2018 at 7:24:58 PM UTC-4, Gregory Ewing wrote:
> Tamara Berger wrote:
> > I typed these 2 lines in the terminal:
> > 
> > 192:~ TamaraB$ sudo python3
>  > ...
> python3 -m pip install pytest
> 
> You need to enter this *single* line in the Terminal:
> 
> sudo python3 -m pip install pytest
> 
> > What does the "-m" stand for in the line of code?
> 
> It's a cmmand-line option to the python interpreter
> telling it to execute a module.
> 
> (What you did was first launch the Python interpreter and
> then tell it to run "python3 -m pip install pytest" as a
> Python statement. But it's not Python code, it's a shell
> command.)
> 
> -- 
> Greg

Thanks, Greg. But I got a permission error. Here is my command at the prompt 
and the terminal's response.

192:~ TamaraB$ sudo python3 -m pip install pytest

Password:

The directory '/Users/TamaraB/Library/Caches/pip/http' or its parent directory 
is not owned by the current user and the cache has been disabled. Please check 
the permissions and owner of that directory. If executing pip with sudo, you 
may want sudo's -H flag.
The directory '/Users/TamaraB/Library/Caches/pip' or its parent directory is 
not owned by the current user and caching wheels has been disabled. check the 
permissions and owner of that directory. If executing pip with sudo, you may 
want sudo's -H flag.
Requirement already satisfied: pytest in 
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Requirement already satisfied: setuptools in 
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages 
(from pytest)
Requirement already satisfied: pluggy<0.7,>=0.5 in 
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages 
(from pytest)
Requirement already satisfied: atomicwrites>=1.0 in 
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages 
(from pytest)
Requirement already satisfied: more-itertools>=4.0.0 in 
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages 
(from pytest)
Requirement already satisfied: six>=1.10.0 in 
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages 
(from pytest)
Requirement already satisfied: py>=1.5.0 in 
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages 
(from pytest)
Requirement already satisfied: attrs>=17.4.0 in 
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages 
(from pytest)
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

So I'm stuck again. I thought "sudo" was supposed to take care of permissions. 
Do you have a suggestion?

Thanks,

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


Re: Posting warning message

2018-06-12 Thread T Berger
On Tuesday, June 12, 2018 at 3:28:29 AM UTC-4, Cameron Simpson wrote:
> On 11Jun2018 22:51, Tamara Berger  wrote:
> >On Monday, June 11, 2018 at 7:24:58 PM UTC-4, Gregory Ewing wrote:
> >> Tamara Berger wrote:
> >> > I typed these 2 lines in the terminal:
> >> > 192:~ TamaraB$ sudo python3
> >> python3 -m pip install pytest
> >>
> >> You need to enter this *single* line in the Terminal:
> >> sudo python3 -m pip install pytest
> >>
> >> > What does the "-m" stand for in the line of code?
> >> It's a cmmand-line option to the python interpreter
> >> telling it to execute a module.
> >
> >Thanks, Greg. But I got a permission error. Here is my command at the prompt 
> >and the terminal's response.
> >
> >192:~ TamaraB$ sudo python3 -m pip install pytest
> >Password:
> >The directory '/Users/TamaraB/Library/Caches/pip/http' or its parent 
> >directory 
> >is not owned by the current user and the cache has been disabled. Please 
> >check 
> >the permissions and owner of that directory. If executing pip with sudo, you 
> >may want sudo's -H flag.
> 
> sudo leaves the $HOME environment variable unchanged, at least on my Mac. So 
> it 
> is using your personal cache directory. And rejecting it becuse it is 
> (correctly) owned by you.
> 
> >The directory '/Users/TamaraB/Library/Caches/pip' or its parent directory is 
> >not owned by the current user and caching wheels has been disabled. check 
> >the 
> >permissions and owner of that directory. If executing pip with sudo, you may 
> >want sudo's -H flag.
> 
> Have a look at the sudo command's manual page, by running the command:
> 
>   man sudo
> 
> In that we can read this:
> 
>-H  The -H (HOME) option option sets the HOME environment
>variable to the home directory of the target user (root by
>default) as specified by the password database.  The
>default handling of the HOME environment variable depends
>on sudoers(5) settings.  By default, sudo will set HOME if
>env_reset or always_set_home are set, or if set_home is
>set and the -s option is specified on the command line.
> 
> So the message is a reasonable suggestion, and it is suggesting that you run 
> this command:
> 
>   sudo -H python3 -m pip install pytest
> 
> Regarding the other messages:
> 
> >Requirement already satisfied: pytest in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> >Requirement already satisfied: setuptools in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: pluggy<0.7,>=0.5 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: atomicwrites>=1.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: more-itertools>=4.0.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: six>=1.10.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: py>=1.5.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: attrs>=17.4.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> 
> This is all fine - it is just saying that various prerequisites are already 
> there.
> 
> >You are using pip version 9.0.1, however version 10.0.1 is available.
> >You should consider upgrading via the 'pip install --upgrade pip' command.
> 
> This is just a suggestion to upgrade pip. Since you're running pip from 
> Python's "pip" builtin module this effectively suggests upgrading your Python 
> 3 
> install.  Not important or urgent.
> 
> >So I'm stuck again. I thought "sudo" was supposed to take care of 
> >permissions. 
> >Do you have a suggestion?
> 
> Sudo isn't magic, and treating it like magic is very common, which is one 
> reason I discourage unthinking use of it.
> 
> Sudo exists to let your run specific commands as root, the system superuser.  
> (It also has modes to run as other users, but root is the default and also 
> the 
> most dangerous.)
> 
> When you use sudo you have almost unlimited power to change things. This is 
> handy for installation activities, and also handy for doing unbound damage to 
> the OS install.
> 
> I still recommend that you avoid sudo here and use pip's --user option, 
> installing the packages in your personal Python tree. It will work just as 
> well 
> for almost every purpose and avoid risk to your machine's OS.
> 
> Cheers,
> Cameron Simpson 

Thanks a lot, Cameron. I was going to try the --user option this morning, if no 
one had responded to my post.
-

Re: Posting warning message

2018-06-12 Thread T Berger
On Monday, June 11, 2018 at 7:24:58 PM UTC-4, Gregory Ewing wrote:
> Tamara Berger wrote:
> > I typed these 2 lines in the terminal:
> > 
> > 192:~ TamaraB$ sudo python3
>  > ...
> python3 -m pip install pytest
> 
> You need to enter this *single* line in the Terminal:
> 
> sudo python3 -m pip install pytest
> 
> > What does the "-m" stand for in the line of code?
> 
> It's a cmmand-line option to the python interpreter
> telling it to execute a module.
> 
> (What you did was first launch the Python interpreter and
> then tell it to run "python3 -m pip install pytest" as a
> Python statement. But it's not Python code, it's a shell
> command.)
> 
> -- 
> Greg

Thanks, Greg, for your answer. It helped me out of that hole.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Posting warning message

2018-06-12 Thread T Berger
On Tuesday, June 12, 2018 at 3:28:29 AM UTC-4, Cameron Simpson wrote:
> On 11Jun2018 22:51, Tamara Berger  wrote:
> >On Monday, June 11, 2018 at 7:24:58 PM UTC-4, Gregory Ewing wrote:
> >> Tamara Berger wrote:
> >> > I typed these 2 lines in the terminal:
> >> > 192:~ TamaraB$ sudo python3
> >> python3 -m pip install pytest
> >>
> >> You need to enter this *single* line in the Terminal:
> >> sudo python3 -m pip install pytest
> >>
> >> > What does the "-m" stand for in the line of code?
> >> It's a cmmand-line option to the python interpreter
> >> telling it to execute a module.
> >
> >Thanks, Greg. But I got a permission error. Here is my command at the prompt 
> >and the terminal's response.
> >
> >192:~ TamaraB$ sudo python3 -m pip install pytest
> >Password:
> >The directory '/Users/TamaraB/Library/Caches/pip/http' or its parent 
> >directory 
> >is not owned by the current user and the cache has been disabled. Please 
> >check 
> >the permissions and owner of that directory. If executing pip with sudo, you 
> >may want sudo's -H flag.
> 
> sudo leaves the $HOME environment variable unchanged, at least on my Mac. So 
> it 
> is using your personal cache directory. And rejecting it becuse it is 
> (correctly) owned by you.
> 
> >The directory '/Users/TamaraB/Library/Caches/pip' or its parent directory is 
> >not owned by the current user and caching wheels has been disabled. check 
> >the 
> >permissions and owner of that directory. If executing pip with sudo, you may 
> >want sudo's -H flag.
> 
> Have a look at the sudo command's manual page, by running the command:
> 
>   man sudo
> 
> In that we can read this:
> 
>-H  The -H (HOME) option option sets the HOME environment
>variable to the home directory of the target user (root by
>default) as specified by the password database.  The
>default handling of the HOME environment variable depends
>on sudoers(5) settings.  By default, sudo will set HOME if
>env_reset or always_set_home are set, or if set_home is
>set and the -s option is specified on the command line.
> 
> So the message is a reasonable suggestion, and it is suggesting that you run 
> this command:
> 
>   sudo -H python3 -m pip install pytest
> 
> Regarding the other messages:
> 
> >Requirement already satisfied: pytest in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> >Requirement already satisfied: setuptools in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: pluggy<0.7,>=0.5 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: atomicwrites>=1.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: more-itertools>=4.0.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: six>=1.10.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: py>=1.5.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: attrs>=17.4.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> 
> This is all fine - it is just saying that various prerequisites are already 
> there.
> 
> >You are using pip version 9.0.1, however version 10.0.1 is available.
> >You should consider upgrading via the 'pip install --upgrade pip' command.
> 
> This is just a suggestion to upgrade pip. Since you're running pip from 
> Python's "pip" builtin module this effectively suggests upgrading your Python 
> 3 
> install.  Not important or urgent.
> 
> >So I'm stuck again. I thought "sudo" was supposed to take care of 
> >permissions. 
> >Do you have a suggestion?
> 
> Sudo isn't magic, and treating it like magic is very common, which is one 
> reason I discourage unthinking use of it.
> 
> Sudo exists to let your run specific commands as root, the system superuser.  
> (It also has modes to run as other users, but root is the default and also 
> the 
> most dangerous.)
> 
> When you use sudo you have almost unlimited power to change things. This is 
> handy for installation activities, and also handy for doing unbound damage to 
> the OS install.
> 
> I still recommend that you avoid sudo here and use pip's --user option, 
> installing the packages in your personal Python tree. It will work just as 
> well 
> for almost every purpose and avoid risk to your machine's OS.
> 
> Cheers,
> Cameron Simpson 

Just one more thing, Cameron. I was looking at an Apple support page, and it 
says "When you're logged in to you

Re: Posting warning message

2018-06-12 Thread T Berger
On Tuesday, June 12, 2018 at 3:28:29 AM UTC-4, Cameron Simpson wrote:
> On 11Jun2018 22:51, Tamara Berger  wrote:
> >On Monday, June 11, 2018 at 7:24:58 PM UTC-4, Gregory Ewing wrote:
> >> Tamara Berger wrote:
> >> > I typed these 2 lines in the terminal:
> >> > 192:~ TamaraB$ sudo python3
> >> python3 -m pip install pytest
> >>
> >> You need to enter this *single* line in the Terminal:
> >> sudo python3 -m pip install pytest
> >>
> >> > What does the "-m" stand for in the line of code?
> >> It's a cmmand-line option to the python interpreter
> >> telling it to execute a module.
> >
> >Thanks, Greg. But I got a permission error. Here is my command at the prompt 
> >and the terminal's response.
> >
> >192:~ TamaraB$ sudo python3 -m pip install pytest
> >Password:
> >The directory '/Users/TamaraB/Library/Caches/pip/http' or its parent 
> >directory 
> >is not owned by the current user and the cache has been disabled. Please 
> >check 
> >the permissions and owner of that directory. If executing pip with sudo, you 
> >may want sudo's -H flag.
> 
> sudo leaves the $HOME environment variable unchanged, at least on my Mac. So 
> it 
> is using your personal cache directory. And rejecting it becuse it is 
> (correctly) owned by you.
> 
> >The directory '/Users/TamaraB/Library/Caches/pip' or its parent directory is 
> >not owned by the current user and caching wheels has been disabled. check 
> >the 
> >permissions and owner of that directory. If executing pip with sudo, you may 
> >want sudo's -H flag.
> 
> Have a look at the sudo command's manual page, by running the command:
> 
>   man sudo
> 
> In that we can read this:
> 
>-H  The -H (HOME) option option sets the HOME environment
>variable to the home directory of the target user (root by
>default) as specified by the password database.  The
>default handling of the HOME environment variable depends
>on sudoers(5) settings.  By default, sudo will set HOME if
>env_reset or always_set_home are set, or if set_home is
>set and the -s option is specified on the command line.
> 
> So the message is a reasonable suggestion, and it is suggesting that you run 
> this command:
> 
>   sudo -H python3 -m pip install pytest
> 
> Regarding the other messages:
> 
> >Requirement already satisfied: pytest in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> >Requirement already satisfied: setuptools in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: pluggy<0.7,>=0.5 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: atomicwrites>=1.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: more-itertools>=4.0.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: six>=1.10.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: py>=1.5.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: attrs>=17.4.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> 
> This is all fine - it is just saying that various prerequisites are already 
> there.
> 
> >You are using pip version 9.0.1, however version 10.0.1 is available.
> >You should consider upgrading via the 'pip install --upgrade pip' command.
> 
> This is just a suggestion to upgrade pip. Since you're running pip from 
> Python's "pip" builtin module this effectively suggests upgrading your Python 
> 3 
> install.  Not important or urgent.
> 
> >So I'm stuck again. I thought "sudo" was supposed to take care of 
> >permissions. 
> >Do you have a suggestion?
> 
> Sudo isn't magic, and treating it like magic is very common, which is one 
> reason I discourage unthinking use of it.
> 
> Sudo exists to let your run specific commands as root, the system superuser.  
> (It also has modes to run as other users, but root is the default and also 
> the 
> most dangerous.)
> 
> When you use sudo you have almost unlimited power to change things. This is 
> handy for installation activities, and also handy for doing unbound damage to 
> the OS install.
> 
> I still recommend that you avoid sudo here and use pip's --user option, 
> installing the packages in your personal Python tree. It will work just as 
> well 
> for almost every purpose and avoid risk to your machine's OS.
> 
> Cheers,
> Cameron Simpson 

Sorry, to bother you again. But is there some way to edit a message once its 
posted? Or do I have to delete it 

Filters

2018-06-12 Thread T Berger
Why doesn't the system allow me to set filters for my own posts? I was able to 
do it once, but when I returned to the forum, I was back among the unfiltered 
posts. When I tried to reapply the filter, the option was grayed out.

Also, I've selected the option to get email updates to my posts, but the option 
seems to work only selectively.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Posting warning message

2018-06-12 Thread T Berger
On Tuesday, June 12, 2018 at 10:27:06 AM UTC-4, Chris Angelico wrote:
> On Wed, Jun 13, 2018 at 12:17 AM, T Berger  wrote:
> >
> > Sorry, to bother you again. But is there some way to edit a message once 
> > its posted? Or do I have to delete it and rewrite it?
> 
> Nope. And you can't delete it either.
> 
> ChrisA

I deleted them a number of time, then got a bar across the page indicating that 
a post had been deleted. It's nuts that you can't edit your own post.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Posting warning message

2018-06-12 Thread T Berger
On Tuesday, June 12, 2018 at 3:28:29 AM UTC-4, Cameron Simpson wrote:
> On 11Jun2018 22:51, Tamara Berger  wrote:
> >On Monday, June 11, 2018 at 7:24:58 PM UTC-4, Gregory Ewing wrote:
> >> Tamara Berger wrote:
> >> > I typed these 2 lines in the terminal:
> >> > 192:~ TamaraB$ sudo python3
> >> python3 -m pip install pytest
> >>
> >> You need to enter this *single* line in the Terminal:
> >> sudo python3 -m pip install pytest
> >>
> >> > What does the "-m" stand for in the line of code?
> >> It's a cmmand-line option to the python interpreter
> >> telling it to execute a module.
> >
> >Thanks, Greg. But I got a permission error. Here is my command at the prompt 
> >and the terminal's response.
> >
> >192:~ TamaraB$ sudo python3 -m pip install pytest
> >Password:
> >The directory '/Users/TamaraB/Library/Caches/pip/http' or its parent 
> >directory 
> >is not owned by the current user and the cache has been disabled. Please 
> >check 
> >the permissions and owner of that directory. If executing pip with sudo, you 
> >may want sudo's -H flag.
> 
> sudo leaves the $HOME environment variable unchanged, at least on my Mac. So 
> it 
> is using your personal cache directory. And rejecting it becuse it is 
> (correctly) owned by you.
> 
> >The directory '/Users/TamaraB/Library/Caches/pip' or its parent directory is 
> >not owned by the current user and caching wheels has been disabled. check 
> >the 
> >permissions and owner of that directory. If executing pip with sudo, you may 
> >want sudo's -H flag.
> 
> Have a look at the sudo command's manual page, by running the command:
> 
>   man sudo
> 
> In that we can read this:
> 
>-H  The -H (HOME) option option sets the HOME environment
>variable to the home directory of the target user (root by
>default) as specified by the password database.  The
>default handling of the HOME environment variable depends
>on sudoers(5) settings.  By default, sudo will set HOME if
>env_reset or always_set_home are set, or if set_home is
>set and the -s option is specified on the command line.
> 
> So the message is a reasonable suggestion, and it is suggesting that you run 
> this command:
> 
>   sudo -H python3 -m pip install pytest
> 
> Regarding the other messages:
> 
> >Requirement already satisfied: pytest in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> >Requirement already satisfied: setuptools in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: pluggy<0.7,>=0.5 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: atomicwrites>=1.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: more-itertools>=4.0.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: six>=1.10.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: py>=1.5.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> >Requirement already satisfied: attrs>=17.4.0 in 
> >/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
> > (from pytest)
> 
> This is all fine - it is just saying that various prerequisites are already 
> there.
> 
> >You are using pip version 9.0.1, however version 10.0.1 is available.
> >You should consider upgrading via the 'pip install --upgrade pip' command.
> 
> This is just a suggestion to upgrade pip. Since you're running pip from 
> Python's "pip" builtin module this effectively suggests upgrading your Python 
> 3 
> install.  Not important or urgent.
> 
> >So I'm stuck again. I thought "sudo" was supposed to take care of 
> >permissions. 
> >Do you have a suggestion?
> 
> Sudo isn't magic, and treating it like magic is very common, which is one 
> reason I discourage unthinking use of it.
> 
> Sudo exists to let your run specific commands as root, the system superuser.  
> (It also has modes to run as other users, but root is the default and also 
> the 
> most dangerous.)
> 
> When you use sudo you have almost unlimited power to change things. This is 
> handy for installation activities, and also handy for doing unbound damage to 
> the OS install.
> 
> I still recommend that you avoid sudo here and use pip's --user option, 
> installing the packages in your personal Python tree. It will work just as 
> well 
> for almost every purpose and avoid risk to your machine's OS.
> 
> Cheers,
> Cameron Simpson 

One more thing about PEP8. My workbook is a bit skimpy on details. Is there a 
quick way to make the edits or am

PEP8 compliance

2018-06-13 Thread T Berger
Sorry for this basic question, but to change my code if it's failed the PEP8 
test, what code do I use to open my program and make changes? Obviously, I 
should still be in bash, but then what?

Thanks,

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


Re: PEP8 compliance

2018-06-13 Thread T Berger
On Wednesday, June 13, 2018 at 11:04:39 AM UTC-4, T Berger wrote:
> Sorry for this basic question, but to change my code if it's failed the PEP8 
> test, what code do I use to open my program and make changes? Obviously, I 
> should still be in bash, but then what?
> 
> Thanks,
> 
> Tamara

I did make the changes in IDLE, but I thought I must be in the wrong place. The 
line of code I got in terminal was:
/Users/TamaraB/Desktop/mymodules/vsearch.py:1:25: E231 missing whitespace after 
':'
def search4vowels(phrase:str)->set:

I thought the 1:25: E231 couldn't be referring to anything in my text editor. 
But now I see that 1:25 refers to the first line, 25th spot (I suppose the 25 
refers to the spot BEFORE which I'm supposed to add white space. I don't know 
what the E231 refers to, but it doesn't seem helpful.

And, no, I'm not going to make these picayune changes that actually make the 
code harder to read. Adding a white space between "phrase:" and "str" just 
splits apart a conceptual unit in a complicated line of code. I was just doing 
this exercise in my workbook.

Thanks,

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


Re: PEP8 compliance

2018-06-13 Thread T Berger
On Wednesday, June 13, 2018 at 1:44:49 PM UTC-4, Paul  Moore wrote:
> On 13 June 2018 at 17:35, T Berger  wrote:
> 
> > I did make the changes in IDLE, but I thought I must be in the wrong place. 
> > The line of code I got in terminal was:
> > /Users/TamaraB/Desktop/mymodules/vsearch.py:1:25: E231 missing whitespace 
> > after ':'
> > def search4vowels(phrase:str)->set:
> >
> > I thought the 1:25: E231 couldn't be referring to anything in my text 
> > editor. But now I see that 1:25 refers to the first line, 25th spot (I 
> > suppose the 25 refers to the spot BEFORE which I'm supposed to add white 
> > space. I don't know what the E231 refers to, but it doesn't seem helpful.
> 
> That's the correct interpretation of that message. Well done (and I
> don't mean that patronisingly) - messages from tools like whatever it
> was that reported these errors to you are often rooted in assumptions
> which are *far* from obvious to someone new to programming.
> 
> To expand a little:
> 
> The 1 is as you say the line on which the tool spotted the problem.
> Program text is viewed (by tools just as by people) as a block of
> lines of text, numbered starting from line 1. Tools will number blank
> lines (lines with nothing on them) equally with lines with text on
> them - sometimes people number only the non-blank lines, but
> programming tools don't typically do that.
> 
> The 25 does refer to the position on the line that the tool is
> referring to. Position is measured in characters. You say "spot", and
> that's as good a term as any. Characters as counted by a computer
> include letters, numbers, punctuation, and even spaces. You can think
> of it as "column on the screen" in this case and not be far wrong.
> 
> The E231 is a code for the specific error that the tool found - so it
> means "missing whitespace". The text of the message is all you need to
> deal with, but having a unique, concise code can help, for example
> when looking up information in the documentation or the source code of
> the tool. It's very helpful to quote error numbers like this when
> reporting problems or asking for help, as they are more precise (to
> people who know how to interpret them) than the textual message. But
> reporting the text as well is crucial, as it saves people having to
> look up the code to know what you're talking about!
> 
> > And, no, I'm not going to make these picayune changes that actually make 
> > the code harder to read. Adding a white space between "phrase:" and "str" 
> > just splits apart a conceptual unit in a complicated line of code. I was 
> > just doing this exercise in my workbook.
> 
> That's a very good attitude. There *are* good reasons for many of the
> style recommendations, and as you learn more you may be persuaded to
> change your view, but style guides are all ultimately about making
> your code "readable", and it sounds like you are already developing a
> good sense of how you want to group and present your code. That's
> something many programmers can take a long time (years, in some cases)
> to develop, and a good sense of style is often (IMO) what separates
> good programmers from mediocre/bad ones. Reading other people's code
> is often a very good way to develop a sense of style, if you get the
> chance to do so.
> 
> Paul

Thanks, Paul, for your encouraging, informative reply

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


Re: How to apply filters to posts

2018-06-13 Thread T Berger
On Tuesday, April 10, 2018 at 1:21:53 AM UTC-4, Chris Angelico wrote:

> I recommend, instead, joining the mailing list:
> 
> https://mail.python.org/mailman/listinfo/python-list

There seem to be two options on the Python-list Information Page.  

* Subscribe to the list (see sections below)
* Send email to python-list@python.org

Which are you recommending?

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


Re: How to apply filters to posts

2018-06-14 Thread T Berger
On Thursday, June 14, 2018 at 8:02:44 AM UTC-4, Chris Angelico wrote:

> They're connected. "Subscribe to the list" makes you a member of the
> mailing list (and thus you will start receiving posts), which also
> entitles you to send to the list. Sending email to that address will
> send it to the list. So what you're seeing is not options, but steps -
> first you subscribe, then you send email.

OK. And can you tell me how to apply filters so that only replies to my emails 
are included. I subscribed to the list a couple of weeks ago and then had to 
unsubscribe because I was getting emails on every posted topic.

Thanks,

Tamara

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


Re: How to apply filters to posts

2018-06-14 Thread T Berger
On Thursday, June 14, 2018 at 11:26:00 AM UTC-4, Rhodri James wrote:
> On 14/06/18 16:00, T Berger wrote:
> > On Thursday, June 14, 2018 at 8:02:44 AM UTC-4, Chris Angelico wrote:
> > 
> >> They're connected. "Subscribe to the list" makes you a member of the
> >> mailing list (and thus you will start receiving posts), which also
> >> entitles you to send to the list. Sending email to that address will
> >> send it to the list. So what you're seeing is not options, but steps -
> >> first you subscribe, then you send email.
> > 
> > OK. And can you tell me how to apply filters so that only replies to my 
> > emails are included. I subscribed to the list a couple of weeks ago and 
> > then had to unsubscribe because I was getting emails on every posted topic.
> 
> That's exactly how mailing lists work: you get everything.  Any 
> filtering has to be done at your end in your mail program.  Personally I 
> use Thunderbird, get it to sort messages into threads (sequences of 
> conversation, in effect) and only read the threads that seem interesting.
> 
> -- 
> Rhodri James *-* Kynesim Ltd

Thanks, Rhodri. One more question. What is a daily digest? I'm wondering 
whether to choose that option.

Tamara 

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


Re: How to apply filters to posts

2018-06-14 Thread T Berger
On Thursday, June 14, 2018 at 3:39:44 PM UTC-4, Ben Finney wrote:
> T Berger  writes:
> 
> > Thanks, Rhodri. One more question. What is a daily digest? I'm
> > wondering whether to choose that option.
> 
> Don't choose the daily digest, because it makes a special “digest”
> message for you each day. That message is disconnected from any other
> message, and so you will not be able to reply correctly to any
> discussion. It's not appropriate for anyone who wants to also
> participate in discussions.
> 
> -- 
>  \   “I have said to you to speak the truth is a painful thing. To |
>   `\  be forced to tell lies is much worse.” —Oscar Wilde, _De |
> _o__) Profundis_, 1897 |
> Ben Finney

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


Re: Posting warning message

2018-06-15 Thread T Berger
On Monday, June 11, 2018 at 4:32:56 AM UTC-4, Cameron Simpson wrote:

> This is one reason to prefer the mailing list. You can subscribe here:
> 
>   https://mail.python.org/mailman/listinfo/python-list
> 
> Many of us prefer that to Google Groups. You have the advantage that email 
> messages arrive to your GMail directly, instead of to the group. You can 
> easily 
> file messages from the list into its own folder (in GMail, this is called 
> "apply a label").
> 
> Wait for the first message or so and for that message choose GMail's "filter 
> messages like this" action. I like to choose "Apply the label Python" and 
> "Skip 
> the inbox" for such things. Then you'll get a nice little "Python" mail 
> folder 
> in your collection where the list will accumulate. And less spam than the 
> Group.

Sounds great, Cameron. But Gmail doesn't give me the options "Apply the label 
Python" and "Skip the inbox" under "Filter messages like this." I just get the 
generic To, From, Has the words, Doesn't have. 

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


Flask failure

2018-06-15 Thread T Berger
I’m trying to build a webapp with flask. I installed flask, created a webapp in 
IDLE, but when I tried testing it at my terminal, I got a huge error message. 
This is the app:

from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello() -> str:
    return 'Hello world from Flask!'
app.run()

This is my command and the resulting error message, containing a warning in red:

Last login: Thu Jun 14 23:54:55 on ttys000
192:~ TamaraB$ cd Desktop/Webapp/
192:Webapp TamaraB$ python3 hello_flask.py
 * Serving Flask app "hello_flask" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: off
Traceback (most recent call last):
  File "hello_flask.py", line 6, in 
    app.run()
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py",
line 943, in run
    run_simple(host, port, self, **options)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/werkzeug/serving.py",
line 814, in run_simple
    inner()
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/werkzeug/serving.py",
line 774, in inner
    fd=fd)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/werkzeug/serving.py",
line 660, in make_server
    passthrough_errors, ssl_context, fd=fd)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/werkzeug/serving.py",
line 577, in __init__
    self.address_family), handler)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py",
line 453, in __init__
    self.server_bind()
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/server.py",
line 136, in server_bind
    socketserver.TCPServer.server_bind(self)
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socketserver.py",
line 467, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 48] Address already in use
192:Webapp TamaraB$

What went wrong?
-- 
https://mail.python.org/mailman/listinfo/python-list


Python list vs google group

2018-06-15 Thread T Berger
I'm suspecting that posting to python google groups (this site) gets more 
responses than mailing to the python list. Am I correct? Also, contrary to what 
I read on the python list information sheet, what shows up in this forum does 
not match what comes into my inbox. I started a post here and then replied to a 
post from my inbox. That reply does not show up in this forum. 

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


Re: Python list vs google group

2018-06-15 Thread T Berger
On Friday, June 15, 2018 at 11:31:47 AM UTC-4, Alister wrote:

> it certainly seems to be the source of most SPAM
> as such some users of this list/newsgroup call it what you like block all 
> posts from google groups

But you don't think you get more replies to a question posted here than emailed 
to the list? The forum and the email list are supposed to be different access 
routes to the same content, but I don't find that to be the case. I replied to 
a post via email, but my reply did not show up on this forum.

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


Re: Python list vs google group

2018-06-15 Thread T Berger
On Friday, June 15, 2018 at 12:14:30 PM UTC-4, Mark Lawrence wrote:
> On 15/06/18 16:47, T Berger wrote:
> > On Friday, June 15, 2018 at 11:31:47 AM UTC-4, Alister wrote:
> > 
> >> it certainly seems to be the source of most SPAM
> >> as such some users of this list/newsgroup call it what you like block all
> >> posts from google groups
> > 
> > But you don't think you get more replies to a question posted here than 
> > emailed to the list? The forum and the email list are supposed to be 
> > different access routes to the same content, but I don't find that to be 
> > the case. I replied to a post via email, but my reply did not show up on 
> > this forum.
> > 
> > Tamara
> > 
> 
> For the third and final time, just get a (semi-)decent email client/news 
> reader/whatever it's called, point it at news.gmane.org and read this 
> forum, hundreds of other python forums and thousands of other technical 
> forums with no problems at all.  No cluttered inbox so no need to filter 
> anything.  I happen to use thunderbird, there are umpteen other choices.
> 
> -- 
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
> 
> Mark Lawrence

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


Re: Python list vs google group

2018-06-15 Thread T Berger
On Friday, June 15, 2018 at 11:55:59 AM UTC-4, Chris Angelico wrote:
> Perhaps quantity is not the important thing here.

It is the important thing. I'm stuck with a problem and still waiting for 
replies to my email. I've decided to repost my problem here, so we'll see 
whether my hypothesis holds water.

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


Re: Python list vs google group

2018-06-15 Thread T Berger
On Friday, June 15, 2018 at 12:14:30 PM UTC-4, Mark Lawrence wrote:

> For the third and final time, just get a (semi-)decent email client/news 
> reader/whatever it's called, point it at news.gmane.org and read this 
> forum, hundreds of other python forums and thousands of other technical 
> forums with no problems at all.  No cluttered inbox so no need to filter 
> anything.  I happen to use thunderbird, there are umpteen other choices.

To do this, I will have to research what you mean by "a (semi-)decent email 
client/news reader," and "point it at news.gmane.org." I'm a little unused to 
web-related lingo. Then I'll have to root around in gmane.org to see how it 
works. This is not to say that I might not try this route, only that it will 
take a bit of time and effort. I just set some filters on the incoming python 
email, and will see how it works first. But thanks for your thrice-proffered 
suggestion.

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


Re: Python list vs google group

2018-06-15 Thread T Berger
Hi Rich,

Please define YMMV, MUA.

Thanks,

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


Re: Python list vs google group

2018-06-15 Thread T Berger
On Friday, June 15, 2018 at 12:32:17 PM UTC-4, T Berger wrote:
> On Friday, June 15, 2018 at 11:55:59 AM UTC-4, Chris Angelico wrote:
> > Perhaps quantity is not the important thing here.
> 
> It is the important thing. I'm stuck with a problem and still waiting for 
> replies to my email. I've decided to repost my problem here, so we'll see 
> whether my hypothesis holds water.
> 
> Tamara

If anyone wants to take a stab at my problem, its subject line is "Flask 
Failure."

Thanks,

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


Re: Flask failure

2018-06-18 Thread T Berger
On Friday, June 15, 2018 at 1:48:16 PM UTC-4, Elismar Luz wrote:
> Address already in use!

Hi Elismar,

I'm new to Python and didn't understand your post when I first read it. 

Thanks, 

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


Proper way to download stylesheets and templates

2018-06-25 Thread T Berger
I’m creating a webapp and trying to download a stylesheet and templates from my 
manual’s support site. I must be doing something wrong, because when I try to 
run my app, I get a 404 error message. I downloaded the files by dragging them 
off the screen into my webapp folder. But I’m getting a weird extension: 
“hf.css.webloc.” Is this the problem? Is there a proper way to download such 
files?
Thanks, 
Tamara 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Proper way to download stylesheets and templates

2018-06-25 Thread T Berger
On Monday, June 25, 2018 at 12:12:26 PM UTC-4, T Berger wrote:
> I’m creating a webapp and trying to download a stylesheet and templates from 
> my manual’s support site. I must be doing something wrong, because when I try 
> to run my app, I get a 404 error message. I downloaded the files by dragging 
> them off the screen into my webapp folder. But I’m getting a weird extension: 
> “hf.css.webloc.” Is this the problem? Is there a proper way to download such 
> files?
> Thanks, 
> Tamara

I solved my problem. Please ignore the question.
Tamar
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   5   >