Re: Seekable output from ClientForm?

2005-02-09 Thread mac
In article <[EMAIL PROTECTED]>, Matej Cepl wrote:
> Hi,
> 
> using python 2.3, ClientForm, and ClientCookie and I have this code:
> 
> opener = ClientCookie.build_opener(ClientCookie.HTTPRefererProcessor,
>ClientCookie.HTTPRefreshProcessor,
>ClientCookie.SeekableProcessor)
> 
> response = opener.open(lxURL)
> forms = ClientForm.ParseResponse(response)
> form = forms[0]
> response.seek(0)
> 
> form['extpatid'] = MyNEUlogin
> form['extpatpw'] = MyNEUpassword
> formopener = form.click()
> 
> response2 = ClientCookie.urlopen(formopener)
>
> guidednews = re.compile("s_guidednews.html")
> 
> response2.seek(0)
> h = htmllib.HTMLParser(formatter.NullFormatter())
> h.feed(response2.read())
> print h.anchorlist
> 
> Unfortunately, it doesn't work, because response2 was created by
> ClientForm and it is not seekable (apparently, I get "AttributeError:
> addinfourl instance has no attribute 'seek'").
> 
> How to make output of ClientForm seekable, please?

Instead of:
  response2 = ClientCookie.urlopen(formopener)
try:
  opener.open(formopener)

Cheers, 
Maciek

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


idiom for constructor?

2005-06-01 Thread Mac
Is there a nice Python idiom for constructors which would expedite the
following?

class Foo:
  def __init__(self, a,b,c,d,...):
self.a = a
self.b = b
self.c = c
self.d = d
...

I would like to keep the __init__ parameter list explicit, as is,
rather than passing in a dictionary, as I want the code to be explicit
about what arguments it expects... in effect enforcing the right number
of arguments.

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


Re: idiom for constructor?

2005-06-01 Thread Mac
> You might look to see if you can customize your editor to use
> templates/interaction and then inserts the right text for you.

Well, I'm not really concerned with "amount of typing" as much as with
the inherent ugliness, tediousness, and lack of elegance of the
original form. Alas, templates/macros would not fix the latter.

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


bug with isinstance() ?

2005-06-01 Thread Mac
Under certain circumstances isinstance() seems to return incorrect
value for me.  I'm using Python 2.3 (latest from Debian's unstable).
Here's a sample program... the multi-module nature of the code is key.


=== test.py ===

class Foo:
pass

def test():
from test2 import make_me_a_foo
foo = make_me_a_foo()
if isinstance(foo, Foo):
print "is a Foo"
else:
print "is  NOT  a Foo!"

if __name__ == "__main__":
test()


=== test2.py ===

from test import Foo

def make_me_a_foo():
return Foo()


--8<--

When I run "python test.py", I get "is  NOT  a Foo!", when the object
clearly IS a Foo!  Am I missing something, or is this a bug?

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


Re: bug with isinstance() ?

2005-06-01 Thread Mac
I see, interesting.  OK, I understand that recursive importing can be
problematic (having to "hide" the test2 import should have been a tip
off; it's just that in my original app this relationship is not as
clear), but what is the lesson I should take away from this?  I mean, I
was under the impression that "once a Foo, always a Foo", while from
the above I'm starting to see that a single class definition can give
rise to a multiple number of classes, and that the classes are
parametrized by the module they come from (I guess that makes sense...
else class names would have to be unique throughout all the source for
a single program)... I guess the problem is I'm thinking of "classes"
as these abstract concepts, sort of like Platonian "forms", whereas I
should be thinking of classes as "class objects", object instances,
each coming from some module's namespace...  is this sort of the idea?
Someone help me wrap my head around this, please. :)

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


Re: idiom for constructor?

2005-06-01 Thread Mac
This was the direction I was aiming for initially, and I have used this
form before, but was hoping there was a way I could go one step
further, and somehow get rid of the repetition of "self."...  Heh,
ideally:

  self.{a,b,c,d} = a,b,c,d

Alas, not Python syntax... :)

I do like Steven's form of a solution, and I think I'll give it a spin
for the really ugly spots (refactoring is too expensive right now;
prototype-code).

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


any macro-like construct/technique/trick?

2005-06-01 Thread Mac
Is there a way to mimic the behaviour of C/C++'s preprocessor for
macros?  The problem: a lot of code like this:

def foo():
#  do some stuff
if debug:
emit_dbg_obj(DbgObjFoo(a,b,c))

#  do more stuff
if debug:
emit_dbg_obj(DbgObjBar(d,e))

# ... and so on ...

Notes:

* the two-lines of debug conditional tend to really break up the flow
of the surrounding code

* in C you could wrap them with a macro so you could do
DEBUG_EMIT(DbgObjFoo(a,b,c)), etc, with the macro only instantiating
the object and processing it if the debug flag was set.  The one-liner
is MUCH less disruptive visually when reading code

* using
   def debug_emit(obj):
   if debug:
   emit_dbg_obj(obj)
is a poor solution, because it *always* instantiates DbgObj*, even when
not needed; I want to avoid such unnecessary waste

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


Re: bug with isinstance() ?

2005-06-01 Thread Mac
OK, it's al coming together now, thx. Grrr... all this
misconception, again, due to the evil, evil, EVIL influence of having
worked a lot before with an inferior language (C/C++)... :)

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


Re: any macro-like construct/technique/trick?

2005-06-01 Thread Mac
After I wrote my post I realized I didn't provide enough context of
what I'm doing, hence it is not quite clear to any readers why the heck
I would want this.  The gist is this.  I have a number of algorithms
that perform the same task. I'm trying to assess which ones work better
under which circumstances, which means I'm timing them (interested in
*relative* speed, so Python is acceptable).  I also have a second app
which allows me to "observe" the operation of said algorithms by
consuming such emitted debug objects and graphically displaying the
information therein.  I'm "observing" with a very fine granularity,
which means a debug object is emitted between almost every single line.
Naturally, if every second line is debug code (or worse, as above, 1
line of real code, 2 lines of debug code), the readability of the
algorithm is horrendous, making further development a pain.  Since,
when I'm NOT observing the algorithms then I'm timing them, I want the
debug/observe code to have minimal impact on the runtimes;
instantiating some of these debug objects is rather costly.

There, hopefully this gives a better picture of my motivation.  If
anyone can suggest alternate way to structure such code, I'm all ears
(... well, eyes, really... :)

Your proposal for one-lining the code as "if debug: emit_."
occurred to me, but for readability reasons I want as visually *short*
a line as possible, so it doesn't detract from the other code. The C
preprocessor was particularly helpful in such "shortening". (e.g.,
print "foo"; DBG(DbgObj(..)); print "bar";)

Hmm, with this setup you can't get any shorter than the instantiation
of the DebugObject... which gives me an idea... the "if debug:" could
be placed within DebugObjectBase, and all the DebugObjects inherit from
it... no... wait... no good, the problem is the following case:
   ...
   # real line of code
   DbgObjFoo(a,b,costly_function(c))
   # real line of code

On a debugging/observing run, the debugging objects occasionally have
their constructor values computed externally, as above, and the
proposed solution would not save us from that costly computation.

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


some profiler questions

2005-06-07 Thread Mac
I'm writing a bunch of algorithms in Python for solving a certain class
of problems, and I was interested in doing some comparisons between
them and would like to collect various high-level runtime stats, such
as the number of invocations of certain key subroutines.  I have my own
code to do this.  Then just earlier today it hit me that I'm really
just profiling, albeit in a more restricted way than the "profile"
module.  This got me thinking and looking deeper at "profile.py", and
I've got some questions:

1) I'd still like to run my whole app (i.e., using main()), but I'd
like to limit the profiling to only the select few subroutines.  That
is, say I have a set of such fns in mind, call it "key_fns", and I
would like to only profile # of invocations of these fns from key_fns,
as well as by whom they were called, and how much cumulative time was
spent in them.  Is such lower-level control possible?  The main reason
I want this is that I do not want to profile most of the low-level
routines, like vector addition, at least not yet... I don't want to
slow down code execution any more than is necessary, as the statistics
gathering should occur during "normal" runs (i.e., during normal
operation).

2) I've only just discovered that pstats has "print_callers()"!  That's
very useful info I wasn't aware was available!  What I'm really looking
for now is profiler output in the style generated by "gprof", the GNU
profiler, as I have found that format terribly useful (a section for
each fn, with the fn's callers and callees interwoven in each section).
 Does anyone know of a utility which would format the Python profiling
info in that format, or something very similar?  I haven't actually
seen any output from print_callers (can't find any samples on Net, and
my app is currently half-busted, mid-refactor), so if that's what it
precisely does, ignore this question.

3) assuming the above-mentioned fine control of (1) is not yet
possible, I will muddle on with my own "selective" profiling code; the
question I have then is, what is the cleanest way to override a class
instance's method at runtime?  What my profiler is doing is overriding
the key fns/methods of an instance with a stat-gatherer-instrumented
version, which ends up calling the original method.  I tried reading
profile.py and pstats.py for ideas, but they are a little too
complicated for me, for now; I doubt that's how they do their profiling
anyways. Any way to do this in an automated fashion, given that I have
the list of method names I want to instrument in a list variable?

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


MixIn method to call the method it overrides: how?

2005-06-18 Thread Mac
I have a MixIn class which defines a method foo(), and is then mixed in
with another class by being prepended to that class's __bases__ member,
thus overriding that class's definition of foo().  In my application
though it is necessary for the MixIn's foo() to call the overridden
foo().  How can I do this?

My current hack is to do this:

def foo():  # MixIn's method
orig_bases = self.__class__.__bases__
bases = list(orig_bases)
bases.remove(OptEdgeCache)
self.__class__.__bases__ = tuple(bases)
foo_orig = self.foo
self.__class__.__bases__ = orig_bases

# other stuff here...


Is there a better way?  Does the above even work as I think it does?

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


Change in cgi handling of POST requests

2009-02-10 Thread Mac
We just upgraded Python to 2.6 on some of our servers and a number of
our CGI scripts broke because the cgi module has changed the way it
handles POST requests.  When the 'action' attribute was not present in
the form element on an HTML page the module behaved as if the value of
the attribute was the URL which brought the user to the page with the
form, but without the query (?x=y...) part.  Now FieldStorage.getvalue
() is giving the script a list of two copies of the value for some of
the parameters (folding in the parameters from the previous request)
instead of the single string it used to return for each.  I searched
this newsgroup looking for a discussion of the proposal to impose this
change of behavior, and perhaps I wasn't using the right phrases in my
search, but I didn't find anything.  I see that Perl still behaves the
way pre-2.6 Python used to (not that I view that as a reason for
anything).  We'll work around the breakage by explicitly setting the
'action' attribute everywhere, of course, but I usually see some
discussion (often heated) of the impact of behavior changes on
existing software when something like this is in the works.  Did I
miss it?

I also noted that the module is making some deprecated use of the
BaseException class.

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


broken setuptools dependencies

2008-11-19 Thread Mac
I just tried to set up a Windows box as a client talking to a MySQL
database on Linux using Python.  So I installed the most recent
version of Python (2.6) and then I tried to add the MySQLdb module.
There wasn't any binary pre-built for Python 2.6 on Windows (or any
other OS), so I pulled down the tarball, unpacked it, and ran setup.py
install.  That blew up because it couldn't find the version of
setuptools that it needed on the cheeseshop.python.org server.

I have to say that I find all the different packaging installation
options more than a little confusing (wasn't Perl supposed to be the
language that gave you more ways to do something than you really
wanted?), and I find myself wondering why the standard distribution of
Python doesn't come with everything you need to install a third-party
package.  That would come closer to the "batteries included" paradigm
the community likes to advertise.

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


setuptools catch 22

2009-04-16 Thread Mac
We've got ActiveState Python 2.6 installed on a Windows XP box, and I
pulled down the latest archgenxml package (2.2) in order to get it
running under this installation of Python.  I unpacked the tarball for
the package and tried running `python setup.py build' but got an
ImportError exception: "no module named setuptools."  So back to
Google, where I find http://pypi.python.org/pypi/setuptools, which
says "[For Windows] install setuptools using the provided .exe
installer."  I go down to the bottom of the page and I see that there
is no .exe installer for Python 2.6.  All there is for that version of
Python is setuptools-0.6c9-py2.6.egg.  I get the impression from the
references to "Python Eggs" on the setuptools page that setuptools is
a utility for installing Python Eggs.  So we're supposed to use a
utility that isn't installed yet to install that utility?  Does anyone
else understand how lame this is?  From where I stand, the story for
installation of third-party packages in Python is a sad, confused
mess, and the Achilles heel of a language of which in all other
respects I think very highly.
--
http://mail.python.org/mailman/listinfo/python-list


Re: setuptools catch 22

2009-04-16 Thread Mac
On Apr 16, 11:52 am, Kay Schluehr  wrote:

> Yes, but there is a known workaround: 

Thanks, Kay.  Of course, the workaround would be better known if the
setuptools web page had those instructions instead of "install using
the [non-existent] .exe file." :-)
--
http://mail.python.org/mailman/listinfo/python-list


python 3.5.0rc1 problem opening IDLE in windows

2015-12-04 Thread Nicky Mac
Dear python team
since windows applied some updates last night to my windows 10 and windows
7 systems,
I can't open anything with IDLE as I usually do.
On windows 10 (64bit with 64bit python), I performed the installation
repair procedure.
* Edit with IDLE does not appear as an installed windows program.
* when I open my usual shortcut to IDLE (
C:\Python\Python35\Lib\idlelib\idle.py)
 something briefly flashes on the screen *and immediately disappears.*
* if I directly open a python program in windows, I get these options (as
usual):-
edit with IDLE (-> python launcher for windows console)
edit with IDLE  (-> edit with IDLE (64bit))  - which I always
use, *nothing
happens*

Any ideas gratefully received!!!
sincerely
Nick "Mac" McElwaine
-- 
https://mail.python.org/mailman/listinfo/python-list


unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-22 Thread Nicky Mac
I have run the install (and repair) which explicitly includes Tcl/Tk and l
have this problem:

Microsoft Windows [Version 10.0.10586] (c) 2015 Microsoft Corporation. All
rights reserved.

>C:\Python\Python35\python.exe -m idlelib
** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **

Please suggest how this can be fixed
any support greatly appreciated

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


Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-23 Thread Nicky Mac
slight progress:
i reinstalled ticking precompile options in the "Advanced features".
Now I get this:
icrosoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\Nick>python -m idlelib
C:\Python\Python35\python.exe: Error while finding spec for
'idlelib.__main__' (: bad magic number in 'idlelib':
b'\x03\xf3\r\n'); 'idlelib' is a package and cannot be directly executed

any help hugely appreciated!
season's greetings
Nick

On 22 December 2015 at 20:27, Nicky Mac  wrote:

> I have run the install (and repair) which explicitly includes Tcl/Tk and l
> have this problem:
>
> Microsoft Windows [Version 10.0.10586] (c) 2015 Microsoft Corporation. All
> rights reserved.
>
> >C:\Python\Python35\python.exe -m idlelib
> ** IDLE can't import Tkinter.
> Your Python may not be configured for Tk. **
>
> Please suggest how this can be fixed
> any support greatly appreciated
>
> Nick  McElwaine
>



-- 
Nick "Mac" McElwaine
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-23 Thread Nicky Mac
dear Python team
thanks for your amazing support!
no sign of old Py2.7 anywhere :-

C:\Users\Nick>python -c "import sys; print(*sys.path, sep='\n')"

C:\Python\Python35\python35.zip
C:\Python\Python35\DLLs
C:\Python\Python35\lib
C:\Python\Python35
C:\Python\Python35\lib\site-packages


On 23 December 2015 at 19:30, eryk sun  wrote:

> On Wed, Dec 23, 2015 at 8:38 AM, Nicky Mac  wrote:
> >
> > I removed the old python2.7 entries in system Path, the PYTHON variables
> you
> > mentioned are not present.
> > All I have is Python35 in the PATH.
>
> Maybe there's still a stale directory on sys.path for another reason.
> Print sys.path from the command prompt:
>
> python -c "import sys; print(*sys.path, sep='\n')"
>
> P.S. Please reply to the list also this time.
>



-- 
Nick "Mac" McElwaine
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-24 Thread Nicky Mac
Hello again.]
not sure what you mean by "my profile".
following your suggestion, looks normal:

C:\Users\Nick> python -c "import importlib;
print(importlib.find_loader('idlelib').path)"
C:\Python\Python35\lib\idlelib\__init__.pyc

A search for idlelib shows this one plus one deep inside OpenOffice and a
Game.

On 23 December 2015 at 21:20, eryk sun  wrote:

> On Wed, Dec 23, 2015 at 1:51 PM, Nicky Mac  wrote:
> >
> > no sign of old Py2.7 anywhere :-
> >
> > C:\Users\Nick>python -c "import sys; print(*sys.path, sep='\n')"
> >
> > C:\Python\Python35\python35.zip
> > C:\Python\Python35\DLLs
> > C:\Python\Python35\lib
> > C:\Python\Python35
> > C:\Python\Python35\lib\site-packages
>
> The first blank entry is for the current directory. Do you maybe have
> an old "idlelib" directory in your profile?
>
> Print what it's attempting to load:
>
> python -c "import importlib;
> print(importlib.find_loader('idlelib').path)"
>



-- 
Nick "Mac" McElwaine
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-24 Thread Nicky Mac
Dear python Team
I think I've been wasting your time:

C:\Users\Nick>path
PATH=C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Program
Files\Broadcom\Broadcom 802.11 Network
Adapter;;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
Files (x86)\ATI
Technologies\ATI.ACE\Core-Static;C:\Python\Python35\Scripts\;C:\Python\Python35\

somehow the new py3.5 has been added to the end, not the beginning.
guess this path is what you meant by "my profile".
I'll set about fixing it.
Meery christmas to you all
Nick

On 24 December 2015 at 11:06, Nicky Mac  wrote:

> Hello again.]
> not sure what you mean by "my profile".
> following your suggestion, looks normal:
>
> C:\Users\Nick> python -c "import importlib;
> print(importlib.find_loader('idlelib').path)"
> C:\Python\Python35\lib\idlelib\__init__.pyc
>
> A search for idlelib shows this one plus one deep inside OpenOffice and a
> Game.
>
> On 23 December 2015 at 21:20, eryk sun  wrote:
>
>> On Wed, Dec 23, 2015 at 1:51 PM, Nicky Mac  wrote:
>> >
>> > no sign of old Py2.7 anywhere :-
>> >
>> > C:\Users\Nick>python -c "import sys; print(*sys.path, sep='\n')"
>> >
>> > C:\Python\Python35\python35.zip
>> > C:\Python\Python35\DLLs
>> > C:\Python\Python35\lib
>> > C:\Python\Python35
>> > C:\Python\Python35\lib\site-packages
>>
>> The first blank entry is for the current directory. Do you maybe have
>> an old "idlelib" directory in your profile?
>>
>> Print what it's attempting to load:
>>
>> python -c "import importlib;
>> print(importlib.find_loader('idlelib').path)"
>>
>
>
>
> --
> Nick "Mac" McElwaine
>



-- 
Nick "Mac" McElwaine
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-24 Thread Nicky Mac
what a horrible environment windows is to support anything!
(I was a UNIX professional).
seems the user profile PATH is a registry entry, and was not updated when I
deinstalled Python2.7
still haven't  figured out how to change it - I will NOT attempy a regedit.

season's greetings

On 24 December 2015 at 13:59, Nicky Mac  wrote:

> Dear python Team
> I think I've been wasting your time:
>
> C:\Users\Nick>path
> PATH=C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Program
> Files\Broadcom\Broadcom 802.11 Network
> Adapter;;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
> Files (x86)\ATI
> Technologies\ATI.ACE\Core-Static;C:\Python\Python35\Scripts\;C:\Python\Python35\
>
> somehow the new py3.5 has been added to the end, not the beginning.
> guess this path is what you meant by "my profile".
> I'll set about fixing it.
> Meery christmas to you all
> Nick
>
> On 24 December 2015 at 11:06, Nicky Mac  wrote:
>
>> Hello again.]
>> not sure what you mean by "my profile".
>> following your suggestion, looks normal:
>>
>> C:\Users\Nick> python -c "import importlib;
>> print(importlib.find_loader('idlelib').path)"
>> C:\Python\Python35\lib\idlelib\__init__.pyc
>>
>> A search for idlelib shows this one plus one deep inside OpenOffice and a
>> Game.
>>
>> On 23 December 2015 at 21:20, eryk sun  wrote:
>>
>>> On Wed, Dec 23, 2015 at 1:51 PM, Nicky Mac  wrote:
>>> >
>>> > no sign of old Py2.7 anywhere :-
>>> >
>>> > C:\Users\Nick>python -c "import sys; print(*sys.path, sep='\n')"
>>> >
>>> > C:\Python\Python35\python35.zip
>>> > C:\Python\Python35\DLLs
>>> > C:\Python\Python35\lib
>>> > C:\Python\Python35
>>> > C:\Python\Python35\lib\site-packages
>>>
>>> The first blank entry is for the current directory. Do you maybe have
>>> an old "idlelib" directory in your profile?
>>>
>>> Print what it's attempting to load:
>>>
>>> python -c "import importlib;
>>> print(importlib.find_loader('idlelib').path)"
>>>
>>
>>
>>
>> --
>> Nick "Mac" McElwaine
>>
>
>
>
> --
> Nick "Mac" McElwaine
>



-- 
Nick "Mac" McElwaine
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-24 Thread Nicky Mac
sorry to be such a darned nuisance -
fixed the PATH to eliminate Py2.7 references but get same result:

C:\Users\Nick>path
PATH=C:\Python\Python35\Scripts\;C:\Python\Python35\;C:\ProgramData\Oracle\Java\javapath;C:\Program
Files\Broadcom\Broadcom 802.11 Network
Adapter;;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
Files (x86)\ATI Technologies\ATI.ACE\Core-Static;

C:\Users\Nick>python -m idlelib
C:\Python\Python35\python.exe: Error while finding spec for
'idlelib.__main__' (: bad magic number in 'idlelib':
b'\x03\xf3\r\n'); 'idlelib' is a package and cannot be directly executed

On 24 December 2015 at 14:52, Nicky Mac  wrote:

> what a horrible environment windows is to support anything!
> (I was a UNIX professional).
> seems the user profile PATH is a registry entry, and was not updated when
> I deinstalled Python2.7
> still haven't  figured out how to change it - I will NOT attempy a regedit.
>
> season's greetings
>
> On 24 December 2015 at 13:59, Nicky Mac  wrote:
>
>> Dear python Team
>> I think I've been wasting your time:
>>
>> C:\Users\Nick>path
>> PATH=C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Program
>> Files\Broadcom\Broadcom 802.11 Network
>> Adapter;;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
>> Files (x86)\ATI
>> Technologies\ATI.ACE\Core-Static;C:\Python\Python35\Scripts\;C:\Python\Python35\
>>
>> somehow the new py3.5 has been added to the end, not the beginning.
>> guess this path is what you meant by "my profile".
>> I'll set about fixing it.
>> Meery christmas to you all
>> Nick
>>
>> On 24 December 2015 at 11:06, Nicky Mac  wrote:
>>
>>> Hello again.]
>>> not sure what you mean by "my profile".
>>> following your suggestion, looks normal:
>>>
>>> C:\Users\Nick> python -c "import importlib;
>>> print(importlib.find_loader('idlelib').path)"
>>> C:\Python\Python35\lib\idlelib\__init__.pyc
>>>
>>> A search for idlelib shows this one plus one deep inside OpenOffice and
>>> a Game.
>>>
>>> On 23 December 2015 at 21:20, eryk sun  wrote:
>>>
>>>> On Wed, Dec 23, 2015 at 1:51 PM, Nicky Mac 
>>>> wrote:
>>>> >
>>>> > no sign of old Py2.7 anywhere :-
>>>> >
>>>> > C:\Users\Nick>python -c "import sys; print(*sys.path, sep='\n')"
>>>> >
>>>> > C:\Python\Python35\python35.zip
>>>> > C:\Python\Python35\DLLs
>>>> > C:\Python\Python35\lib
>>>> > C:\Python\Python35
>>>> > C:\Python\Python35\lib\site-packages
>>>>
>>>> The first blank entry is for the current directory. Do you maybe have
>>>> an old "idlelib" directory in your profile?
>>>>
>>>> Print what it's attempting to load:
>>>>
>>>> python -c "import importlib;
>>>> print(importlib.find_loader('idlelib').path)"
>>>>
>>>
>>>
>>>
>>> --
>>> Nick "Mac" McElwaine
>>>
>>
>>
>>
>> --
>> Nick "Mac" McElwaine
>>
>
>
>
> --
> Nick "Mac" McElwaine
>



-- 
Nick "Mac" McElwaine
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-24 Thread Nicky Mac
wow - a very comprehensive answer.
However it seems I have now got it correctly reinstalled  with the correct
environment and path (as below) So I'm back to my original problem:

C:\Users\Nick>python -m idlelib
** IDLE can't import Tkinter.
Your Python may not be configured for Tk. **

On doing a repair or modify to install tcl/Tk again, the same result.

C:\Users\Nick>python -c "import sys; print(*sys.path, sep='\n')"
 gives
C:\Python\Python35\python35.zip
C:\Python\Python35\DLLs
C:\Python\Python35\lib
C:\Python\Python35
C:\Python\Python35\lib\site-packages
This looks OK,  Python35 directory contains Lib and tcl as it does on my
now working Win7 system, and Lib contains tkinter

C:\Users\Nick>path
PATH=C:\Python\Python35\Scripts\;C:\Python\Python35\;C:\ProgramData\Oracle\Java\javapath;C:\Program
Files\Broadcom\Broadcom 802.11 Network
Adapter;;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
Files (x86)\ATI Technologies\ATI.ACE\Core-Static;
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-25 Thread Nicky Mac
thanks again for continuing to address my problem.
all those files are present as required.
This is a hard slog.
Maybe I should give up and fallback to my now working win 7 system
until a resolution crops up via an update/upgrade.
Have  a happy and peaceful Christmas


On 24 December 2015 at 22:17, eryk sun  wrote:

> On Thu, Dec 24, 2015 at 3:29 PM, Nicky Mac  wrote:
> >
> > C:\Users\Nick>python -m idlelib
> > ** IDLE can't import Tkinter.
> > Your Python may not be configured for Tk. **
>
> In the 3.5 installation directory, ensure that tkinter is installed in
> Lib/tkinter. There should be an "__init__.py" and several other files
> such as "filedialog.py". Also ensure that the DLLs  directory has the
> extension module "_tkinter.pyd" and dependent DLLs "tcl86t.dll" and
> "tk86t.dll".
>



-- 
Nick "Mac" McElwaine
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: unable to open IDLE for Python3.50rc1 on windows10 64bit AMD

2015-12-25 Thread Nicky Mac
problem solved :_
I upgraded to 3.5.1 just released, and it works fine!
(except pillow and pygame installs still dont work, but that's not your
problem)
Enjoy the holidays

On 25 December 2015 at 14:12, Nicky Mac  wrote:

> thanks again for continuing to address my problem.
> all those files are present as required.
> This is a hard slog.
> Maybe I should give up and fallback to my now working win 7 system
> until a resolution crops up via an update/upgrade.
> Have  a happy and peaceful Christmas
>
>
> On 24 December 2015 at 22:17, eryk sun  wrote:
>
>> On Thu, Dec 24, 2015 at 3:29 PM, Nicky Mac  wrote:
>> >
>> > C:\Users\Nick>python -m idlelib
>> > ** IDLE can't import Tkinter.
>> > Your Python may not be configured for Tk. **
>>
>> In the 3.5 installation directory, ensure that tkinter is installed in
>> Lib/tkinter. There should be an "__init__.py" and several other files
>> such as "filedialog.py". Also ensure that the DLLs  directory has the
>> extension module "_tkinter.pyd" and dependent DLLs "tcl86t.dll" and
>> "tk86t.dll".
>>
>
>
>
> --
> Nick "Mac" McElwaine
>



-- 
Nick "Mac" McElwaine
-- 
https://mail.python.org/mailman/listinfo/python-list


problem using pickle

2016-03-13 Thread Nicky Mac
Dear Python team,
I have studied the excellent documentation, and attempted to make use of
pickle thus:

filename = 'my_saved_adventure'
import  pickle
class object:
def __init__(self,i,.t) :
self.id   = i
 .

class world:
def __init__(self):
self.object

class object:
def __init__(self,i,

.then   Object instances of object are created 

myworld = world;
myworld.Object = Object
fileobj = open(filename,'wb')
pickle.dump(myworld,fileobj); fileobj.close()
result = "saved your game to " + filename

fileobj = open(filename,'rb')
myworld = pickle.load(fileobj); fileobj.close()
Object = myworld.Object
result = "restored your game from " + filename


The proecedures execute without error
but a file of only 21b is created containing " €c__main__world q .
altho there are several k of object instance data.

-- 
Nick "Mac" McElwaine
-- 
https://mail.python.org/mailman/listinfo/python-list


reading multiline output

2011-12-22 Thread Mac Smith
Hi,


I have started HandBrakeCLI using subprocess.popen but the output is multiline 
and not terminated with \n so i am not able to read it using readline() while 
the HandBrakeCLI is running. kindly suggest some alternative. i have attached 
the output in a file.



output
Description: Binary data



--
Thanks

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


Re: reading multiline output

2011-12-22 Thread Mac Smith

On 23-Dec-2011, at 6:17 AM, MRAB wrote:

> On 23/12/2011 00:33, Mac Smith wrote:
>> Hi,
>> 
>> 
>> I have started HandBrakeCLI using subprocess.popen but the output is
>> multiline and not terminated with \n so i am not able to read it
>> using readline() while the HandBrakeCLI is running. kindly suggest
>> some alternative. i have attached the output in a file.
>> 
> The lines are terminated with \r, so read with read() and then split on
> "\r".

read() will read the complete output and than i will be able to parse it, i 
want to read the output of the command in realtime.

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


Re: reading multiline output

2011-12-22 Thread Mac Smith

On 23-Dec-2011, at 6:48 AM, MRAB wrote:

> On 23/12/2011 01:07, Mac Smith wrote:
>> 
>> On 23-Dec-2011, at 6:17 AM, MRAB wrote:
>> 
>>> On 23/12/2011 00:33, Mac Smith wrote:
>>>> Hi,
>>>> 
>>>> 
>>>> I have started HandBrakeCLI using subprocess.popen but the output
>>>> is multiline and not terminated with \n so i am not able to read
>>>> it using readline() while the HandBrakeCLI is running. kindly
>>>> suggest some alternative. i have attached the output in a file.
>>>> 
>>> The lines are terminated with \r, so read with read() and then
>>> split on "\r".
>> 
>> read() will read the complete output and than i will be able to parse
>> it, i want to read the output of the command in realtime.
>> 
> Try telling it how much to read with read(size):
> 
> def read_lines(output, line_ending="\n"):
>buffer = ""
> 
>while True:
>chunk = output.read(1024)
>if not chunk:
>break
> 
>buffer += chunk
> 
>while True:
>pos = buffer.find(line_ending)
>if pos < 0:
>break
> 
>pos += len(line_ending)
>yield buffer[ : pos]
>buffer = buffer[pos : ]
> 
>if buffer:
>yield buffer
> -- 
> http://mail.python.org/mailman/listinfo/python-list

thanks, this helped. just need to correct line_ending="\n" should be 
line_ending="\r"

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


subprocess.Popen strange bhaviour

2012-01-18 Thread Mac Smith
Hi,

I am using subprocess.Popen to start a movie ripping command HandBrakeCLI. My 
server is 64bit ubuntu server and has 8 cores. When the command starts it uses 
all 8 cores upto 80%-100% and works fine, but after 270 seconds the cpu usage 
of all the cores drops to 0% - 1%. I tried this many time this happens exactly 
after 270 seconds. Is there some predefined timeout??

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


Report

2005-01-31 Thread decoder-x-mac-gujarati
The original message was received at Mon, 31 Jan 2005 19:08:12 +0500 from 
[140.253.248.170]

- The following addresses had permanent fatal errors -
python-list@python.org



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