can we save print msg into a file when script running ?

2005-10-11 Thread black
hi all~

in my .py file there are a few print to trace out some message and i
wonder if we can save it into a specified file when that script get
running. if so, i may just check that file to c how the script is
running. can anyone show me a right direction ?

one million tks~

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


Re: how to execute .exe file ?

2005-10-11 Thread black
tks !!!

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


are there internal functions for these ?

2005-10-11 Thread black
hi all~

i wrote some functions for copying and moving files caz' i didnt find
concret functions within the doc. but i think these operations are
simple and important so there may be some internal ones i didnt know.
anyone could figure me out ? 

tks~

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


Re: can we save print msg into a file when script running ?

2005-10-12 Thread black
unluckly i am with windows, anyway tks !

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


Re: can we save print msg into a file when script running ?

2005-10-12 Thread black
quote:
===
script.py >> script.log 2>&1
===

what does 2>&1 mean pls ?

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


you having special

2008-08-12 Thread black
you having special

open it
***
http://www.AWSurveys.com/HomeMain.cfm?RefID=Maruthakasi G

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


you having special

2008-08-12 Thread black
you having special

open it
***
http://www.AWSurveys.com/HomeMain.cfm?RefID=Maruthakasi G

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


you having special

2008-08-12 Thread black
you having special

open it
***
http://www.AWSurveys.com/HomeMain.cfm?RefID=Maruthakasi G

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


you having special

2008-08-12 Thread black
you having special

open it
***
http://www.AWSurveys.com/HomeMain.cfm?RefID=Maruthakasi G

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


you having special

2008-08-12 Thread black
you having special

open it
***
http://www.AWSurveys.com/HomeMain.cfm?RefID=Maruthakasi G

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


Is there a way to globally set the print function separator?

2017-10-09 Thread John Black
I want sep="" to be the default without having to specify it every time I 
call print.  Is that possible?

John Black

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


Re: Is there a way to globally set the print function separator?

2017-10-09 Thread John Black
In article , 
__pete...@web.de says...
> 
> John Black wrote:
> 
> > I want sep="" to be the default without having to specify it every time I
> > call print.  Is that possible?
> 
> No, but you can replace the print function with your own:
> 
> >>> print = functools.partial(print, sep="")
> >>> print("I", "recommend", "you", "choose", "another", "name", "and", 
> "preserve", "your", "sanity")
> Irecommendyouchooseanothernameandpreserveyoursanity
> 
> And everybody else's.

print=functools.partial(print, sep="")
NameError: name 'functools' is not defined

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


Re: Is there a way to globally set the print function separator?

2017-10-09 Thread John Black
In article , python@example.invalid says...
> 
> Le 09/10/2017 à 18:22, John Black a écrit :
> > I want sep="" to be the default without having to specify it every time I
> > call print.  Is that possible?
> 
>  >>> oldprint = print
>  >>> def print(*args,**kwargs):
> ...   oldprint(*args,**kwargs,sep='')
> ...
>  >>> print(1,2,3)
> 123

Winner!  Thanks all.

I want to make sure I understand what this line is doing: 

> oldprint = print

Experimenting, I find this is not a rename because I can use both 
function names.  It looks it literally copies the function "print" to 
another function called "oldprint".  But now, I have a way to modify the 
builtin funciton "print" by referencing oldprint.  Without oldprint, I 
have no way to directly modify print?  For example, based on your post, I 
tried:

def print(*args, **kw):
print(*args, sep='', **kw)

meaning print calls print (itself) with sep=''.  But this failed and I 
guess the reason is that it would keep calling itself recursively adding 
sep='' each time?  Thanks.

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


Re: Is there a way to globally set the print function separator?

2017-10-09 Thread John Black
In article , 
eryk...@gmail.com says...
> 
> On Mon, Oct 9, 2017 at 10:04 PM, John Black  wrote:
> > In article , python@example.invalid says...
> >>
> >> Le 09/10/2017 à 18:22, John Black a écrit :
> >> > I want sep="" to be the default without having to specify it every time I
> >> > call print.  Is that possible?
> >>
> >>  >>> oldprint = print
> >>  >>> def print(*args,**kwargs):
> >> ...   oldprint(*args,**kwargs,sep='')
> >> ...
> >>  >>> print(1,2,3)
> >> 123
> >
> > Winner!  Thanks all.
> 
> functools.partial(print, sep='') is the winner, IMO.

Ok, I got that working too after someone told me I have to import 
functools.  Can you explain what it means?  It looks like it is not 
defining another function like the other solutions but is truly changing 
the defaults for the existing function print?

John Black

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


Re: choice of web-framework

2017-10-23 Thread John Black
In article , 
ros...@gmail.com says...
> For the database, I generally use PostgreSQL, unless the job's so
> simple it can be done with flat files. Using Flask with SQLAlchemy is
> a popular option, but you can also dive into psycopg2 directly (the
> "2" doesn't mean "Python 2.7 only", it's fine). The tech stack
> Python+Flask+SQLAlchemy+PostgreSQL+Linux is an extremely solid one, or
> you can switch out any part fairly easily.
> 
> Disclaimer: I use Flask and SQLAlchemy when I'm teaching my students
> how to build web apps in Python, but I don't have much experience with
> any other frameworks or ORMs. Other options may very well be viable
> and/or superior; all I can say is that the above *is* viable.

Chris, thanks for all this detailed information.  I am confused though 
with your database recommendation.  You say you teach SQLAlchemy but 
generally use PostgreSQL yourself.  I can maybe guess why there seems to 
be this contradiction.  Perhaps PostgreSQL is better but too advanced for  
the class you are teaching?  Can you clarify on which you think is the 
better choice?  Thanks.

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


Re: choice of web-framework

2017-10-24 Thread John Black
In article , 
ros...@gmail.com says...
> 
> On Tue, Oct 24, 2017 at 6:57 AM, Chris Warrick  wrote:
> > On 23 October 2017 at 21:37, John Black  wrote:
> >> Chris, thanks for all this detailed information.  I am confused though
> >> with your database recommendation.  You say you teach SQLAlchemy but
> >> generally use PostgreSQL yourself.  I can maybe guess why there seems to
> >> be this contradiction.  Perhaps PostgreSQL is better but too advanced for
> >> the class you are teaching?  Can you clarify on which you think is the
> >> better choice?  Thanks.
> >
> > Different Chris, but I?ll answer. Those are two very different things.
> >
> > PostgreSQL is a database server. It talks SQL to clients, stores data,
> > retrieves it when asked. The usual stuff a database server does.
> > Alternatives: SQLite, MySQL, MS SQL, Oracle DB, ?
> >
> > SQLAlchemy is an ORM: an object-relational mapper, and also a database
> > toolkit. SQLAlchemy can abstract multiple database servers/engines
> > (PostgreSQL, SQLite, MySQL, etc.) and work with them from the same
> > codebase. It can also hide SQL from you and instead give you Python
> > classes. If you use an ORM like SQLAlchemy, you get database support
> > without writing a single line of SQL on your own. But you still need a
> > database engine ? PostgreSQL can be one of them. But you can deploy
> > the same code to different DB engines, and it will just work?
> > (assuming you didn?t use any DB-specific features). Alternatives:
> > Django ORM.
> >
> > psycopg2 is an example of a PostgreSQL client library for Python. It
> > implements the Python DB-API and lets you use it to talk to a
> > PostgreSQL server. When using psycopg2, you?re responsible for writing
> > your own SQL statements for the server to execute. In that approach,
> > you?re stuck with PostgreSQL and psycopg2 unless you rewrite your code
> > to be compatible with the other database/library. Alternatives (other
> > DBs): sqlite3, mysqlclient. There are also other PostgreSQL libraries
> > available.
> >
> 
> Thanks, namesake :)
> 
> The above is correct and mostly accurate. It IS possible to switch out
> your back end fairly easily, though, even with psycopg2; there's a
> standard API that most Python database packages follow. As long as you
> stick to standard SQL (no PostgreSQL extensions) and the standard API
> (no psycopg2 extensions), switching databases is as simple as changing
> your "import psycopg2" into "import cx_oracle" or something. (And,
> most likely, changing your database credentials.)
> 
> The point of an ORM is to make your databasing code look and feel like
> Python code, rather than manually crafting SQL statements everywhere.
> Here's how a simple database operation looks in SQLAlchemy:

Thank you Chris and Chris!

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


Re: Understanding memory location of Python variables

2018-06-18 Thread Jeremy Black
Also, I don't think you can rely on memory being allocated sequentially any
more now that everyone has implemented some level of ASLR.

https://en.wikipedia.org/wiki/Address_space_layout_randomization

On Sat, Jun 16, 2018 at 12:22 PM Alister via Python-list <
python-list@python.org> wrote:

> On Sat, 16 Jun 2018 13:19:04 -0400, Joel Goldstick wrote:
>
> > On Sat, Jun 16, 2018 at 12:38 PM,   wrote:
> >> Hi everyone,
> >>
> >> I'm intrigued by the output of the following code, which was totally
> >> contrary to my expectations. Can someone tell me what is happening?
> >>
> > myName = "Kevin"
> > id(myName)
> >> 47406848
> > id(myName[0])
> >> 36308576
> > id(myName[1])
> >> 2476000
> >>
> >> I expected myName[0] to be located at the same memory location as the
> >> myName variable itself. I also expected myName[1] to be located
> >> immediately after myName[0].
> >> --
> >> https://mail.python.org/mailman/listinfo/python-list
> >
> > Others can probably give a more complete explanation, but small numbers,
> > and apparently letters are cached since they are so common.
>
> also ID is not necessarily a memory location (at least not according to
> the language specification)
> the standard cpython implementation does user the memory location for an
> object's ID but this is an implementation detail
>
> if you are tying to make use of ID in any way to manipulate computer
> memory your program is fundamentaly broken
>
>
>
> --
> Can you MAIL a BEAN CAKE?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


pyqtdeploy on windows

2015-01-16 Thread Hektor black

hi
i have a code with pyqt4 and i want run in android with this tutorial
http://pyqt.sourceforge.net/Docs/pyqtdeploy/command_line.html
my project include of : m.py m.pyw m.ui
when run pyqtdeploy myproject.pdy in cmd get error
installing py 3.4.2 pyqt5 for pyqtdeploy
any one know good tutorial for this module

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


comp.lang.python killfile rule

2017-06-22 Thread John Black
All, in case this is useful to anyone, this rule that tells my newsreader 
which posts to kill really cleans up the group.  I could not find a way 
to key off of anything in the header except keywords because the From 
keeps changing and I didn't want to overkill real posts.  I may have to 
add a thing or two to this over time, but right now, this seems to be 
nailing everything.

John Black 

Subject contains "PEDOFILO"
Or
Subject contains "MAI"
Or
Subject contains "SEGRETO"
Or
Subject contains "SETTA"
Or
Subject contains "BAMBINI"
Or
Subject contains "FIGLIO"
Or
Subject contains "PAOLO"
Or
Subject contains "NATALE"
Or
Subject contains "SONO"
Or
Subject contains "GRAZIA"
Or
Subject contains "PORNOSTAR"
Or
Subject contains "PEZZO"
Or
Subject contains "MERDA"
Or
Subject contains "CAZZO"
Or
Subject contains "GALERA"
Or
Subject contains "SICARIO"
Or
Subject contains "ESSERE"
Or
Subject contains "CRIMINALE"
Or
Subject contains "LECCA"
Or
Subject contains "COCAINA"
Or
Subject contains "LESBICA"
Or
Subject contains "NESSUNO"
Or
Subject contains "MAFIOSO"
Or
Subject contains "BERLUSCONI"
Or
Subject contains ""
Or
Subject contains "HARDCORE"
Or
Subject contains "PEDERASTA"
Or
Subject contains "CULO"
Or
Subject contains "NOSTRA"
Or
Subject contains "FOGLIO"
Or
Subject contains "USARE"
Or
Subject contains "FAMIGLIA"
Or
Subject contains "FECE"
Or
Subject contains "CAPO"
Or
Subject contains "SUICIDARE"
Or
Subject contains "OGNI"
Or
Subject contains "CANE"
Or
Subject contains "MERCATO"
Or
Subject contains "VOLTA"
Or
Subject contains "MAFIOSA"
Or
Subject contains "ALMENO"
Or
Subject contains "BASTARDO"
Or
Subject contains "FIGLIA"
Or
Subject contains "BASTARD"
Or
Subject contains "CRIMINAL"
Or
Subject contains "ANNI"
Or
Subject contains "PEDINA"
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: comp.lang.python killfile rule

2017-06-26 Thread John Black
In article , 
miragewebstudi...@gmail.com says...
> Just felt like posting, wouldn't it be pythonic if it was
> if word in [list]:
> ignore
> 
> Save time and easily maintainable

Yes for readers that can interpret Python.  Mine doesn't.  This is the 
rule per the syntax of my reader but as you say that is easily translated 
to any other format.

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


Re: What's with all of the Case Solution and Test Bank nonsense posts?

2017-07-09 Thread John Black
In article <477bde19-0653-4e41-a717-0efe90ac5...@googlegroups.com>, 
timetowal...@gmail.com says...
> 
> I use https://groups.google.com/forum/#!forum/comp.lang.python to look over 
> message posts.
> 
> What's with all of the Case Solution and Test Bank nonsense posts?
> Is is possible to have these posts filtered out?

Yes it very easy to filter these out with most usenet readers.  Use one 
that lets you setup rules for what gets automatically discarded.  I've 
added these rules to my discard list:

>From contains "Case Solution"
Or
>From contains "Test Banks"

Poof.  All gone.

While you're at it, throw these rules in and the group will appear very 
clean and on topic.

Subject contains "PEDOFILO"
Or
Subject contains "MAI"
Or
Subject contains "SEGRETO"
Or
Subject contains "SETTA"
Or
Subject contains "BAMBINI"
Or
Subject contains "FIGLIO"
Or
Subject contains "PAOLO"
Or
Subject contains "NATALE"
Or
Subject contains "SONO"
Or
Subject contains "GRAZIA"
Or
Subject contains "PORNOSTAR"
Or
Subject contains "PEZZO"
Or
Subject contains "MERDA"
Or
Subject contains "CAZZO"
Or
Subject contains "GALERA"
Or
Subject contains "SICARIO"
Or
Subject contains "ESSERE"
Or
Subject contains "CRIMINALE"
Or
Subject contains "LECCA"
Or
Subject contains "COCAINA"
Or
Subject contains "LESBICA"
Or
Subject contains "NESSUNO"
Or
Subject contains "MAFIOSO"
Or
Subject contains "BERLUSCONI"
Or
Subject contains ""
Or
Subject contains "HARDCORE"
Or
Subject contains "PEDERASTA"
Or
Subject contains "CULO"
Or
Subject contains "NOSTRA"
Or
Subject contains "FOGLIO"
Or
Subject contains "USARE"
Or
Subject contains "FAMIGLIA"
Or
Subject contains "FECE"
Or
Subject contains "CAPO"
Or
Subject contains "SUICIDARE"
Or
Subject contains "OGNI"
Or
Subject contains "CANE"
Or
Subject contains "MERCATO"
Or
Subject contains "VOLTA"
Or
Subject contains "MAFIOSA"
Or
Subject contains "ALMENO"
Or
Subject contains "BASTARDO"
Or
Subject contains "FIGLIA"
Or
Subject contains "BASTARD"
Or
Subject contains "CRIMINAL"
Or
Subject contains "ANNI"
Or
Subject contains "PEDINA"

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


Re: What's with all of the Case Solution and Test Bank nonsense posts?

2017-07-10 Thread John Black
In article , 
jon+use...@unequivocal.eu says...
> 
> On 2017-07-10, John Black  wrote:
> > While you're at it, throw these rules in and the group will appear very 
> > clean and on topic.
> >
> > Subject contains "PEDOFILO"
> > Or
> > Subject contains "MAI"
> > Or
> > Subject contains "SEGRETO"
> [snip >100 lines of rules]
> 
> Or just "subject does not contain any lower-case letters".

That is probably ok, but I was worried some legit posts would get caught 
in that.

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


Re: python decorator

2017-02-21 Thread Argentinian Black ops lll
Thanks for the quick response...! you saved me a lot of time, thank you!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python decorator

2017-02-21 Thread Argentinian Black ops lll
*** SOLVED ***
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to make super() work with externally defined methods in inheritance???

2018-08-15 Thread Paint-It-Black via Python-list
> # this prints for me when I run this in 3.6 

excuse me, that is an extraneous comment from a cut and paste, in fact the 
example never makes it to the prints, as shown in the transcript just below the 
source code
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to make super() work with externally defined methods in inheritance???

2018-08-15 Thread Paint-It-Black via Python-list
> ChrisA

Yes, that works.  Thank you all for your help.  -->


class A:
  def __init__(self):
self.number = 1

def A_biginc(self):
  self.number += 107

A.biginc = A_biginc

class B(A):
  def __init__(self):
super().__init__()
print("making a B")

def B_biginc(self):
  super(B,self).biginc() # super() trips up
  super(B,self).biginc()
  return self.number

B.biginc = B_biginc

def f_ut_oh():
   a = A()
   flag1 = a.number == 1
   a.biginc()
   flag2 = a.number == 108

   b = B()
   flag3 = b.number == 1
   b.biginc() 
   flag4 = b.number == 215

   if flag1 and flag2 and flag3 and flag4 :
 print("all good!") 
   else:
 print("hmm something went wrong..")

print("loaded try_adding_method.py")

>

Python 3.6.6 (default, Jun 27 2018, 14:44:17) 
[GCC 8.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> python.el: native completion setup loaded
>>> loaded try_adding_method.py
>>> f_ut_oh()
making a B
all good!
>>> 
-- 
https://mail.python.org/mailman/listinfo/python-list