[issue45906] Python github installation issue

2021-11-26 Thread Some User


Change by Some User :


--
title: Python github installatiomn issue -> Python github installation issue

___
Python tracker 
<https://bugs.python.org/issue45906>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45906] Python github installatiomn issue

2021-11-26 Thread Some User


New submission from Some User :

Whenever i try to setup python3.9 configure via github, It raises a configure 
error.
``
$ ./configure
checking build system type... type
checking host system type... type
checking for python3.9... no
checking for python3... no
checking for python... no
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "linux"
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in 
`/path/folder_which_contains_cpython_folder/cpython-3.9':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
```

--
components: Installation
messages: 407089
nosy: mazen001.ahmed001
priority: normal
severity: normal
status: open
title: Python github installatiomn issue
type: compile error
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue45906>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: Can we use Python for hacking?

2019-11-20 Thread user
On Tue, 12 Nov 2019 08:49:44 +0400, Abdur-Rahmaan Janhangeer wrote:

> Greetings all,
> 
> Someone requested my answer to the question: "Can we use Python for
> hacking?"
> 
> I compiled some interesting tools and uses here .
> That's as far as i could see. If someone has more examples, he can
> share!
> 
> Yours,
> 
> Abdur-Rahmaan Janhangeer pythonmembers.club
>  | github
> 
> Mauritius

can you post more links for python interesting tools and uses?
any resource related with python and pentesting?

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


[issue2771] Test issue

2019-09-11 Thread ZW Test User


Change by ZW Test User :


--
components: +Tests -Documentation
nosy: +zach.ware
type: enhancement -> behavior
versions:  -Python 3.8

___
Python tracker 
<https://bugs.python.org/issue2771>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



AsyncSSH and timeout

2016-10-27 Thread Standard User
Good day,
I'm trying to run multiple SSH clients using AsyncSSH lib. This is an example 
from manual, which works fine: http://pastebin.com/zh4zymeQ

The problem is, it is not possible to directly set connect timeout in 
run_client() function. However, the manual says:
"asyncio calls can be wrapped in a call to asyncio.wait_for() or asyncio.wait() 
which takes a timeout and provides equivalent functionality."

So I tried to modify run_client() like this: http://pastebin.com/mH7pBuuf
But it spits out a syntax error. I also tried countless variations of it, but 
still no luck. Could someone more knowledgeable help me to set the damn timeout?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: please can i get help on this problem

2015-12-27 Thread User of Products
In other words, nobody wants to do your homework for you. Your fault for being 
a lazy POS and doing everything last minute.
-- 
https://mail.python.org/mailman/listinfo/python-list


Python for Dummies exaple

2015-10-14 Thread NewsLeecher User
Hello,
I have the book Python for Dummies and i downloaden from the Dummiesite some 
python examples.
But with this script i get an error:
But i have not so many experience to see what the error is.
Good someone help me with this ?

#Chapter 3
#Basic Elements and Syntax
#=
#SHORT EXAMPLES
#=

#while loop example
countdown = 10
while countdown:
print countdown,
countdown -= 1
print "blastoff!"

#
#

#try statement with input
user_input = raw_input("Enter an integer: ")
try:
number = int(user_input)
print "You entered", number
except ValueError:
print "Integers, please!"

#class example
class SayMyName:
def __init__(self, myname):
self.myname = myname
def say(self):
print "Hello, my name is", self.myname

name1 = SayMyName("Aahz")
name1.say()

#
#




-- 
- --- -- -
Posted with NewsLeecher v7.0 Beta 2
Web @ http://www.newsleecher.com/?usenet
--- -  -- -

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


Re: Python for Dummies exaple

2015-10-14 Thread NewsLeecher User
In reply to "edmondo.giovanno...@gmail.com" who wrote the following:

> Il giorno mercoled=EC 14 ottobre 2015 12:04:30 UTC+2, Chris Angelico ha scr=
> itto:
> > On Wed, Oct 14, 2015 at 8:55 PM, NewsLeecher User wrote:
> > > But with this script i get an error:
> > > But i have not so many experience to see what the error is.
> > > Good someone help me with this ?
> > =20
> > You need to tell us what the error is :)
> > =20
> > But, looking in my crystal ball, I find a hint that you're using
> > Python 3 and a book that's teaching an older version of Python.
> > Solution: Get a better book.
> > =20
> > ChrisA
> 
> And using the same cristal ball, assuming you are using python 3.x, put bra=
> ckets around the arguments of print like:
> 
> print(countdown)
> ...
> print("Hello, my name is", self.myname)
> 
> etc.
> forget for the moment about the ending comma.

Thanks for the reply.
Oh i did not look good enough that the examples are written in python 2.7
But there are also good things explaning in the book so i will keep it.

Thanks



-- 
- --- -- -
Posted with NewsLeecher v7.0 Beta 2
Web @ http://www.newsleecher.com/?usenet
--- -  -- -

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


[issue2771] Test issue

2013-04-09 Thread Test User Deily

Test User Deily added the comment:

testing

--
nosy: +testusernad -ezio.melotti, mark.dickinson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2771
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Newbie to python. Very newbie question

2013-04-07 Thread ReviewBoard User
Hi
I am a newbie to python and am trying to write a program that does a
sum of squares of numbers whose squares are odd.
For example, for x from 1 to 100, it generates 165 as an output (sum
of 1,9,25,49,81)

Here is the code I have
print reduce(lambda x, y: x+y, filter(lambda x: x%2, map(lambda x:
x*x, xrange
(10**6 = sum(x*x for x in xrange(1, 10**6, 2))

I am getting a syntax error.
Can you let me know what the error is?

I am new to Python and am also looking for good documentation on
python functions. http://www.python.org/doc/ does not provide examples
of usage of each function
-- 
http://mail.python.org/mailman/listinfo/python-list


How to get path to Python standard library directory?

2011-11-25 Thread user
In a Makefile (or sometimes inside python) I need the path to the 
root of the Python standard lib folder used by env python.


e.g.  /usr/lib/python2.6/   orC:\Python27\Lib\

what is the best/canonical way to get that?
--
http://mail.python.org/mailman/listinfo/python-list


Learning Python

2011-08-23 Thread User

Hello all,
Does anyone have any good resources for learning Python? I know basic 
Java and basic Python (loops, data types, if-then statements, etc), but 
I want to delve into Python further. If anyone knows of any good books, 
video tutorials, etc it would be greatly appreciated.

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


Re: develop for Windows on GNU/Linux, using Python

2010-09-20 Thread Default User
On Sun, Sep 19, 2010 at 14:31, J.O. Aho u...@example.net wrote:

 Kev Dwyer wrote:
  On Sun, 19 Sep 2010 12:55:43 -0500, Default User wrote:
 
  Consider:
 
  Can someone do development of programs for use on Windows systems, but
  developed totally on a GNU/Linux system, using standard, contemporary 32
  and / or 64-bit PC hardware?
 
  This would be for someone who can not or will not use Windows, but wants
  to create software for those who do.
 
  This might not include the use of VM for developing on GNU/Linux, as
  that would seem to require a Windows installation disk, which the
  developer may not be able or willing to obtain and use.
 
  Is the correct answer:
  1)  no.
  2) yes.
  3) yes, a Hello World program will run just fine on the Windows Python
  interpreter.
  4) other.
 
  Hello,
 
  The answer is it depends, or 4 on your list of responses.
 
  You can write pure python on a Linux machine and it will run fine on
  Windows as long as you've taken care to program in a portable fashion.

 And not use modules not yet converted to microsoft, seems to happen from
 time
 to time.


  if you have C-extensions in
  your code you'll need to compile them over Windows.  If you want to
  program against the Windows API you'll need access to a Windows box.

 You can always cross compile, not only over OS but even CPU architecture,
 but
 of course testing will be more difficult, on x86 based Linux you can use
 wine
 or similar to test, but can give you some differences to run on a native or
 virtualized instance.



 sigh  . . .

Well, that's about what I expected, unfortunately.   But thanks for the
honest replies.

[OT]
So what's the alternative -- use the end user's browser as an interpreter
for JavaScript or HTML5?
[/OT]


--

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

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


develop for Windows on GNU/Linux, using Python

2010-09-19 Thread Default User
Consider:

Can someone do development of programs for use on Windows systems, but
developed totally on a GNU/Linux system, using standard, contemporary 32 and
/ or 64-bit PC hardware?

This would be for someone who can not or will not use Windows, but wants to
create software for those who do.

This might not include the use of VM for developing on GNU/Linux, as that
would seem to require a Windows installation disk, which the developer may
not be able or willing to obtain and use.

Is the correct answer:
1)  no.
2) yes.
3) yes, a Hello World program will run just fine on the Windows Python
interpreter.
4) other.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python why questions

2010-08-08 Thread Default User
Not to prolong a good food fight, but IIRC, many years ago in QBasic,
one could choose

OPTION BASE 0

or

OPTION BASE 1

to make arrays start with element [0] or element [1], respectively.  Could
such a feature be added to Python without significantly bloating the
interpreter?

Then, if starting with [0] works for you, nothing really changes.  And if
starting with [1] works for you, then you are not made to feel like a
second-class citizen, and about as welcome as a dimwit at the Mensa
meeting.

Isn't Python supposed to be simple and accessible, and therefore fun?
-- 
http://mail.python.org/mailman/listinfo/python-list


Python why questions

2010-08-06 Thread Default User
From the emperor's new clothes department:

1)  Why do Python lists start with element [0], instead of element [1]?
Common sense would seem to suggest that lists should start with [1].

2)  In Python 3, why is print a function only, so that: print Hello, World
is not okay, but it must be print(Hello, World) instead?  (Yeah, I know:
picky, picky . . . )

3)  In Python 3, why does 2.0 / 3.0 display as 0., but 8 *
3.57 displays as 28.56 (rounded off to 2 decimal places)?  And yet, in
Python 2.6, 8 * 3.57 displays as 28.559?

And we wonder why kids don't want to learn to program.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Should I Learn Python or Ruby next?

2010-06-24 Thread Default User
On Thu, Jun 24, 2010 at 02:53, Gregory Ewing greg.ew...@canterbury.ac.nzwrote:

 Jean-Michel Pichavant wrote:

  (that makes me think that Perl should be renamed as it outrageously share
 the same 1st character with Python).


 +1. I suggest CalcifiedMolluscSecretion. The very awkwardness
 of that name will doom the language to the obscurity that it
 deserves relative to the One True Language Whose Name Starts
 With P. :-)

 --
 Greg

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



May I suggest that you read the Python license.  Really read it.  Then read
the Ruby license.  Really read it.

Ask yourself, if I am just using either internally, and not distributing
anything, does it matter which one I use?

Then, ask yourself, if I am creating code to distribute, especially for
commercial purposes, does it matter which one I use?   Which would you be
more willing to bet the farm on (or your house, your career, your food.
etc.)?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: freebsd and multiprocessing

2010-03-02 Thread Pop User
On 3/2/2010 12:59 PM, Tim Arnold wrote:
 
 I'll write some test programs using multiprocessing and see how they
 go before committing to rewrite my current code. I've also been
 looking at 'parallel python' although it may have the same issues.
 http://www.parallelpython.com/
 

parallelpython works for me on FreeBSD 6.2.

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


Re: Google AI Challenge at U of Waterloo

2010-02-05 Thread **Group User**
On Feb 6, 7:02 am, Forthminder menti...@myuw.net wrote:
 Contest runs from 4 February to 26 February 2010.

 You may choose a programming language, such as
 Java, C++, Python, Ruby or Haskell.

 See details at

 http://csclub.uwaterloo.ca/contest/problem_description.php

 Bonne Chance!

 Mentifex
 --http://www.scn.org/~mentifex/mindforth.txt

I find out that
I was a donkie
I was hooked up
Torn
Screwed up
And Haskel was there at that time
He got anrgy, pity
For my stupidity
All for best
Simulation for good alone



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


Manyfile Processing

2009-12-04 Thread user
Hey,

 sorry if i bother you with a beginners question but i have an issue
with processing a bunch of files. They are some arithmetic lists the
processing of one file is an easy task but how do i process many files?
I tried reading that files in to a list and looping over the list
elements but the function won't accept any arguments other than a string.

I would appreciate if you could help me.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Manyfile Processing

2009-12-04 Thread user
On 12/04/2009 12:58 PM, Dan Sommers wrote:
 On Fri, 04 Dec 2009 10:00:53 +0200, user wrote:
 
  sorry if i bother you with a beginners question but i have an issue
 with processing a bunch of files. They are some arithmetic lists the
 processing of one file is an easy task but how do i process many files?
 I tried reading that files in to a list and looping over the list
 elements but the function won't accept any arguments other than a
 string.
 
 Maybe the fileinput module can help.
 
 Dan
 

Hi,

  seems like the fileinput module works fine for me though i am having
quite an issue with the paths.

if i do:


something = fileinput.input(/some/absolute/path/to/list/file.txt)
#the text file contains absolute paths
for line in something:
data=scipy.io.array_import.read_array(line)
print data

it claims that the paths given in the textfiles don't exist no file or
directory though taking one entry from the textfile and inserting it
directly to the command does its job...

Any idea?

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


Re: how can i use lxml with win32com?

2009-10-25 Thread User


On 25 Oct 2009, at 07:45 , elca wrote:


i want to make web scraper.
if possible i really want to make it work together with  
beautifulsoup or

lxml with PAMIE.


Scraping information from webpages falls apart in two tasks:

1. Getting the HTML data
2. Extracting information from the HTML data

It looks like you want to use Internet Explorer for getting the HTML  
data; is there any reason you can't use a simpler approach like using  
urllib2.urlopen()?


Once you have the HTML data, you could feed it into BeautifulSoup or  
lxml.


Mixing up 1 and 2 into a single statement created some confusion for  
you, I think.


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


Re: how can i use lxml with win32com?

2009-10-25 Thread User


On 25 Oct 2009, at 08:06 , elca wrote:


because of javascript im trying to insist use PAMIE.


I see, your problem is not with lxml or BeautifulSoup, but getting the  
raw data in the first place.




i want to extract some text in CNN website with 'CNN Shop'
'Site map' in bottom of CNN website page


What text? Can you give an example?  I'd like to be able to reproduce  
it manually in the webbrowser so I get a clear idea what exactly  
you're trying to achieve.


Greetings,

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


Re: how can i use lxml with win32com?

2009-10-25 Thread User


On 25 Oct 2009, at 08:33 , elca wrote:


www.cnn.com in main website page.
for example ,if you see www.cnn.com's html source, maybe you can  
find such

like line of html source.
http://www.turnerstoreonline.com/ CNN Shop
and for example if i want to extract 'CNN Shop' text in html source.


So, if I understand you correctly, you want your program to do the  
following:


1. Retrieve the http://cnn.com webpage
2. Look for a link identified by the text CNN Shop
3. Extract the URL for that link.

The result would be http://www.turnerstoreonline.com

Is that what you want?

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


Problem with urllib2.urlopen() opening a local file

2009-10-24 Thread deja user

I want to use urlopen() to open either a http://... file or a local
file File:C:/...  I don't have problems opening and reading the file
either way.  But when I run the script on a server (ArcGIS server),
the request won't complete if it was trying to open a local file.
Even though I call close() in either case, something seemed to be
preventing the script to complete if urlopen is trying to open a local
file.  I wonder if there is anything else I should do in the code to
kill the file descriptor, or if it is a known issue that something is
leaking

When running the script standalone, this is not an issue.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Serial connections and threads in a GUI

2009-09-29 Thread user
Aaron Hoover wrote:
 I have a wx-based GUI application that I'd like to have read streaming
 data from a serial port and plot that data using matplotlib and a figure
 canvas. It's a robotic application where the workflow goes something
 like this:
 
 1) Connect to robot
 2) Configure robot settings
 3) Command robot to do something for time, t
 - While robot does something, read sensor data and plot
 4) End of t seconds, resume at (2)
 
 I have the application reading from the serial port in a separate
 thread, but my problem is this - I'd like the user to be able to write
 to the serial port by interacting with the GUI between runs. However,
 the infinite loop running inside the thread responsible for receiving
 data has exclusive access to the serial connection object.
 
 Because of how the application works, I know that I won't need to write
 to the serial port when I'm in the middle of receiving data, so that
 simplifies things somewhat. But, how can I allow the thread access to
 the connection for reading, but then have it give up control over the
 connection when it's done so the main GUI thread can access the
 connection again for writing?
 
 Currently, I have the thread's run() method exit when it's done
 receiving data. But, that means that I can only receive data again using
 the same thread by calling run(), blocking the main GUI thread from
 updating the plot until it completes.
 
 This is my first go at using threads in Python, so I'm sure there's a
 straightforward way to do this that I'm just missing. At any rate,
 thanks in advance for your patience and assistance.
 
 
 Thanks,
 Aaron
Use a few queue objects (see the queue module). Your serial port thread
can have an rx and a tx queue. Your gui program just checks the rx queue
whenever it wants and puts data into the tx queue whenever it wants, and
the queue objects do all the worrying about synchronizing and thread
safety and such. Works like magic!

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


Re: UnboundLocalError - (code is short simple)

2009-09-28 Thread New User
Thank you for the elaboration, Chris!  I don't have the background to follow 
your example code.  However, between your summary of the code, and the code 
examples themselves, I have enough info to get a glimpse of what you're 
explaining.  Also, I can use the info as a foundation for further study on the 
matter.

Thanks too for the feedback about the list.  I'm using a combination of yahoo 
email (to and from the mailing list) and Google Groups, until I figure out 
which works best.  Using a Usenet newsreader client is not an option for me at 
this point.

Martin

--- On Mon, 9/28/09, Chris Kaynor ckay...@zindagigames.com wrote:

From: Chris Kaynor ckay...@zindagigames.com
Subject: Re: UnboundLocalError - (code is short  simple)
To: python-list@python.org
Date: Monday, September 28, 2009, 4:00 PM

On Sun, Sep 27, 2009 at 10:39 PM, New User for_pyt...@yahoo.com wrote:
Hi Chris,

Thank you for the reply and info!

Re:  from coin_toss import coin_toss


My understanding is that this line makes the coin_toss() function in the 
coin_toss.py file available to the toss_winner() function.  Is that what your 
explanation on this point meant (i.e. ... and sets the 
local variable coin_toss to the value of coin_toss in the module coin_toss)?


That is the effect of the statement, however there are cases when the from 
coin_toss import coin_toss may result in a different value in the module. This 
is because:
from coin_toss import coin_tosseffectively does:import coin_tosscoin_toss = 
coin_toss.coin_toss

While this normally works as intended, it can have some unexpected effects. 
Take, for example:

-ALPHA.PY-from gamma import testimport betaimport gamma
test = 2gamma.test = 3print gamma.testprint test
print beta.testprint beta.gamma.test
-BETA.PYfrom gamma import testimport gamma

GAMMA.PY---
test = 1



With this setup, you'll get the output: import Test.alpha321
3


If, however, you change gamma to read:test = ['1']


and the lines in alpha:

test = 2gamma.test = 3
to read:
test.append('2')gamma.test.append('3')
you'll get:
 import Test.alpha['1', '2', '3']['1', '2', '3']['1', '2', '3']['1', '2', 
 '3']



As this shows, the from MODULE import VALUE method rebinds the varible from 
another module in the local scope, and thus does:import MODULE
VALUE = MODULE.VALUEdel MODULE

This means that for some types, the value in MODULE and the value in the local 
scope may not be the same and other times they may be the same.


For your purposes, you'll notice no real difference. However this is something 
to keep in mind.

 

Re:  ... within a function, a different namespace exists , and ... you 
may want to look into the global keyword .


Ok, I will read up on these.  Thank you for the tips!

Martin 

P..S.  I didn't see your reply to my post in the comp.lang.python Google 
Groups.  I assume you emailed your reply directly to me.  I also assume you're 
not looking for my response in comp.lang.python Google Groups.  This is my 
first time posting, so I'm not sure what the posting-reply conventions are.  


 It should have shown up on the python list - I just forgot to remove you from 
it (I used G-Mail's reply all). In general, unless the reply is off-topic or 
personal, it should be replied to on-list. This allows more people to both see 
the answer and to help further explain the answer.
 

--- On Mon, 9/28/09, Chris Kaynor ckay...@zindagigames.com wrote:


From: Chris Kaynor ckay...@zindagigames..com
Subject: Re: UnboundLocalError - (code is short  simple)
To: pylearner for_pyt...@yahoo.com

Cc: python-list@python.org
Date: Monday, September 28, 2009, 4:17 AM

Lets look at what is happening on a few of the lines here:

First:from coin_toss import coin_toss


imports the module coin_toss and sets the local variable coin_toss to the value 
of coin_toss in the module coin_toss.





Second:
coin_toss = coin_toss()

calls the function bound to the name coin_toss and assigns the result to 
coin_toss. Now this appears to be what you want (and run outside a function it 
would work as you intend, the first time). However, within a function, a 
different namespace exists, and Python sees that you are assigning to 
coin_toss, and thus uses the local version of that variable everywhere else 
within the function. As such, Python is attempting to call the 
local variable coin_toss, which has not yet been assigned too.







While not really the correct solution, you may want to look into the 
global keyword for more information about your problem.







Chris


On Sun, Sep 27, 2009 at 8:53 PM, pylearner for_pyt...@yahoo.com wrote:


Python version = 2.6.1

IDLE

Computer = Win-XP, SP2 (current with all windows updates)



---



Greetings:



I have written code for two things:  1) simulate a coin toss, and 2)

assign the toss result to a winner.  Code for the simulated coin toss

is in a file named coin_toss.py.  Code

Re: UnboundLocalError - (code is short simple)

2009-09-28 Thread New User
Thanks for the light you shed on the namespace issue, and for the additional 
info and code example.  I'll be studying more about the info you shared.  Also, 
I tried out your code example, to get firsthand experience with it. 

Cheers,
Martin

--- On Mon, 9/28/09, Bruno Desthuilliers 
bruno.42.desthuilli...@websiteburo.invalid wrote:

From: Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid
Subject: Re: UnboundLocalError - (code is short  simple)
To: python-list@python.org
Date: Monday, September 28, 2009, 8:24 AM

Chris Rebert a écrit :
 On Sun, Sep 27, 2009 at 8:53 PM, pylearner for_pyt...@yahoo.com wrote:
 snip
 ---
 
 Traceback (most recent call last):
  File pyshell#2, line 1, in module
    toss_winner()
  File C:/Python26/toss_winner.py, line 7, in toss_winner
    coin_toss = coin_toss()
 UnboundLocalError: local variable 'coin_toss' referenced before
 assignment
 
 ---
 
 # toss_winner.py
 
 from coin_toss import coin_toss
 
 def toss_winner():
 
    coin_toss = coin_toss()
 
 When Python sees this assignment to coin_toss as it compiles the
 toss_winner() function, it marks coin_toss as a local variable and
 will not consult global scope when looking it up at runtime
(snip)
 To fix the problem, rename the variable so its name differs from that
 of the coin_toss() function. 
(snip)

OP
As an additional note: in Python, everything is an object - including modules, 
classes, and, yes, functions -, so there's no distinct namespace for functions 
or classes. If you try to execute the coin_toss = coin_toss() statement at 
the top level (or declare name 'coin_toss' global prior using it in the 
toss_winner function), you wouldn't get an UnboundLocalError, but after the 
very first execution of the statement you would probably get a TypeError on 
subsquent attempts to call coin_toss:

 def coin_toss():
      print coin_toss called
      return 42

 coin_toss
function coin_toss at 0x952517c
 coin_toss = coin_toss()
coin_toss called
 coin_toss
42
 coin_toss()
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'int' object is not callable


/OP

HTH






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



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


Re: ANN: PyGUI 2.0.1

2009-04-13 Thread user

Greg Ewing wrote:

PyGUI 2.0.1 is available:

  http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/

Fixes some problems in setup.py affecting installation
on Linux and Windows.


What is PyGUI?
--

PyGUI is a cross-platform GUI toolkit designed to be lightweight
and have a highly Pythonic API.



Greg

I installed PyGUI-2.0.1 on Windows (32 bit, non Administrator access).
I got the following error in 2.0.1 when attempting the BlobEdit example:

D:\users\omh\runabq\pyGUIc:\python26\python
Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import pickle
 from GUI import Application,  ScrollableView, Document, Window, \
...   FileType, Cursor, rgb
  File stdin, line 1, in module
  File c:\python26\Lib\site-packages\GUI\__init__.py, line 78, in __getattr__
traceback.print_stack()
Failed to import 'Application' from Applications
Traceback (most recent call last):
  File c:\python26\Lib\site-packages\GUI\__init__.py, line 69, in __getattr__
module = __import__(modname, self.__dict__, locals(), [name])
  File c:\python26\Lib\site-packages\GUI\Win32\Applications.py, line 8, in 
module
import Components, Windows
  File c:\python26\Lib\site-packages\GUI\Win32\Components.py, line 12, in 
module
from Win32 import win_none
  File c:\python26\lib\site-packages\GUI\Win32\__init__.py, line 2, in 
module
raise ImportError(This should not be imported.)
ImportError: This should not be imported.

I presume that one should be able to import GUI.Win32 if I need to import 
win_none from it.

If I comment out line 2, I get the following error:
...
  File c:\python26\Lib\site-packages\GUI\Win32\Components.py, line 12, in 
module
from Win32 import win_none
ImportError: cannot import name win_none

The directory structure that was installed is as follows:
c:\python26\Lib\site-packages\GUI
c:\python26\Lib\site-packages\GUI\Generic
c:\python26\Lib\site-packages\GUI\Resources
c:\python26\Lib\site-packages\GUI\Resources\cursors
c:\python26\Lib\site-packages\GUI\Win32


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


Re: function call overhead

2009-02-03 Thread Default User

The original message in this thread was posted with the intent to
disrupt comp.lang.c by setting follow-ups there. Please either ignore
this thread or change the distribution. Thanks, and sorry our troll has
caused problems in your group.




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


_checkversion.py

2008-11-06 Thread user
As part of the Python 2.5 distribution 
there are some Tools.  Are the notions 
behind checkversions.py still considered 
current?


I find that there is no _checkversion.py 
in my site-packages.


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


python debugger tips?

2008-10-10 Thread just . another . random . user
Hi All,

I'm switching to python from perl, and like the language a ton, but I
find pdb and pydb to be vastly inferior debuggers to the perl version.

In particular, I've grown very used to stepping into arbitrary
functions interactively.  For instance, in perl you can do this:

casqa1:~ perl -de 42

Loading DB routines from perl5db.pl version 1.28
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1):   42
  DB1 sub foo {return 42}



  DB2 s foo()
main::((eval 7)[/usr/local/lib/perl5/5.8.6/perl5db.pl:628]:3):
3:  foo();


  DB3 s
main::foo((eval 6)[/usr/local/lib/perl5/5.8.6/perl5db.pl:628]:2):
2:  sub foo {return 42};
  DB3



Which is quite awesome; I don't have to restart the program if I want
to step through a given function call with a different set of values.

Does anyone have advice on any macros or something that i could use to
do this?

Additionally, what do people recommend as good advanced python
debugger guides?  Explaining breakpoints and all is useful, but I
really want to know how to make sophisticated macros and interact with
the debugger from the interactive prompt.

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


Re: python vs. grep

2008-05-07 Thread Pop User

Anton Slesarev wrote:


But I have some problem with writing performance grep analog.



I don't think you can ever catch grep.  Searching is its only purpose in 
life and its very good at it.  You may be able to come closer, this 
thread relates.


http://groups.google.com/group/comp.lang.python/browse_thread/thread/2f564523f476840a/d9476da5d7a9e466

This relates to the speed of re.  If you don't need regex don't use re. 
 If you do need re an alternate re library might be useful but you 
aren't going to catch grep.



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


Re: Efficient way of testing for substring being one of a set?

2008-04-03 Thread Pop User
[EMAIL PROTECTED] wrote:
  Dennis Benzinger:
  You could use the Aho-Corasick algorithm http://en.wikipedia.org/wiki/
  Aho-Corasick_algorithm.
  I don't know if there's a Python implementation yet.
 
  http://hkn.eecs.berkeley.edu/~dyoo/python/ahocorasick/
 

http://nicolas.lehuen.com/download/pytst/ can do it as well.
-- 
http://mail.python.org/mailman/listinfo/python-list


modify a file

2007-11-04 Thread tech user
Hello,

I have a file which is large about 3.5G.
I need to modify some lines in it,but I don't like to create another file
for the result.
How can i do it? thanks.





  
National Bingo Night. Play along for the chance to win $10,000 every week. 
Download your gamecard now at Yahoo!7 TV. 
http://au.blogs.yahoo.com/national-bingo-night/


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


[issue1000] test

2007-08-22 Thread user

Changes by user:


--
type:  - rfe

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1000
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1000] test

2007-08-22 Thread user

New submission from user:

test patch

--
files: python.diff
messages: 55112
nosy: user
severity: normal
status: open
title: test

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1000
__Index: Modules/_ssl.c
===
--- Modules/_ssl.c  (revision 51574)
+++ Modules/_ssl.c  (working copy)
@@ -317,7 +317,7 @@
 
if (!PyArg_ParseTuple(args, O!|zz:ssl,
  PySocketModule.Sock_Type,
- (PyObject*)Sock,
+ Sock,
  key_file, cert_file))
return NULL;
 
Index: Modules/_ctypes/callproc.c
===
--- Modules/_ctypes/callproc.c  (revision 51574)
+++ Modules/_ctypes/callproc.c  (working copy)
@@ -1230,11 +1230,11 @@
 
 static PyObject *py_dl_close(PyObject *self, PyObject *args)
 {
-   void * handle;
+   int handle;
 
if (!PyArg_ParseTuple(args, i:dlclose, handle))
return NULL;
-   if (dlclose(handle)) {
+   if (dlclose((void*)handle)) {
PyErr_SetString(PyExc_OSError,
   ctypes_dlerror());
return NULL;
@@ -1246,12 +1246,12 @@
 static PyObject *py_dl_sym(PyObject *self, PyObject *args)
 {
char *name;
-   void *handle;
+   int handle;
void *ptr;
 
if (!PyArg_ParseTuple(args, is:dlsym, handle, name))
return NULL;
-   ptr = ctypes_dlsym(handle, name);
+   ptr = ctypes_dlsym((void*)handle, name);
if (!ptr) {
PyErr_SetString(PyExc_OSError,
   ctypes_dlerror());
@@ -1269,7 +1269,7 @@
 static PyObject *
 call_function(PyObject *self, PyObject *args)
 {
-   PPROC func;
+   int func;
PyObject *arguments;
PyObject *result;
 
@@ -1279,7 +1279,7 @@
  PyTuple_Type, arguments))
return NULL;
 
-   result =  _CallProc(func,
+   result =  _CallProc((PPROC)func,
arguments,
 #ifdef MS_WIN32
NULL,
@@ -1300,7 +1300,7 @@
 static PyObject *
 call_cdeclfunction(PyObject *self, PyObject *args)
 {
-   PPROC func;
+   int func;
PyObject *arguments;
PyObject *result;
 
@@ -1310,7 +1310,7 @@
  PyTuple_Type, arguments))
return NULL;
 
-   result =  _CallProc(func,
+   result =  _CallProc((PPROC)func,
arguments,
 #ifdef MS_WIN32
NULL,
@@ -1493,7 +1493,7 @@
 #else
  On:resize,
 #endif
- (PyObject *)obj, size))
+ obj, size))
return NULL;
 
dict = PyObject_stgdict((PyObject *)obj);
Index: Modules/dbmmodule.c
===
--- Modules/dbmmodule.c (revision 51574)
+++ Modules/dbmmodule.c (working copy)
@@ -208,11 +208,13 @@
 static PyObject *
 dbm_has_key(register dbmobject *dp, PyObject *args)
 {
+   char *tmp_ptr;
datum key, val;
int tmp_size;

-   if (!PyArg_ParseTuple(args, s#:has_key, key.dptr, tmp_size))
+   if (!PyArg_ParseTuple(args, s#:has_key, tmp_ptr, tmp_size))
return NULL;
+   key.dptr = tmp_ptr;
key.dsize = tmp_size;
 check_dbmobject_open(dp);
val = dbm_fetch(dp-di_dbm, key);
@@ -224,11 +226,13 @@
 {
datum key, val;
PyObject *defvalue = Py_None;
+   char *tmp_ptr;
int tmp_size;
 
if (!PyArg_ParseTuple(args, s#|O:get,
-  key.dptr, tmp_size, defvalue))
+  tmp_ptr, tmp_size, defvalue))
return NULL;
+   key.dptr = tmp_ptr;
key.dsize = tmp_size;
 check_dbmobject_open(dp);
val = dbm_fetch(dp-di_dbm, key);
@@ -245,11 +249,13 @@
 {
datum key, val;
PyObject *defvalue = NULL;
+   char *tmp_ptr;
int tmp_size;
 
if (!PyArg_ParseTuple(args, s#|S:setdefault,
-  key.dptr, tmp_size, defvalue))
+  tmp_ptr, tmp_size, defvalue))
return NULL;
+   key.dptr = tmp_ptr;
key.dsize = tmp_size;
 check_dbmobject_open(dp);
val = dbm_fetch(dp-di_dbm, key);
Index: Modules/audioop.c
===
--- Modules/audioop.c   (revision 51574)
+++ Modules/audioop.c   (working copy)
@@ -472,8 +472,12 @@
 double aj_m1, aj_lm1;
 double sum_ri_2, sum_aij_2, sum_aij_ri, result, best_result, factor;
 
+   /* Passing a short** for an 's' argument is correct only
+  if the string contents

[issue1001] Test 2

2007-08-22 Thread user

Changes by user:


--
severity: normal
status: open
title: Test 2

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1001
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1767787] MSVC++8 x86 tkinter build patch for trunk

2007-08-07 Thread user

Changes by user:


_
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue1767787
_
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



newbie: HTTPS screen scraping

2007-04-21 Thread user
Hi,
Can anyone help me out here. I would like to authenticate myself to 
a website which uses HTTPS and then after authentication, I would like 
to get the contents of the webpage. How can this be done using python.
I have tried urllib and urllib2 but it has not solved my problem.

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


Re: Regex Speed

2007-02-21 Thread Pop User
[EMAIL PROTECTED] wrote:
 While creating a log parser for fairly large logs, we have run into an
 issue where the time to process was relatively unacceptable (upwards
 of 5 minutes for 1-2 million lines of logs). In contrast, using the
 Linux tool grep would complete the same search in a matter of seconds.
   
Its very hard to beat grep depending on the nature of the regex you are 
searching using. The regex engines in python/perl/php/ruby have traded 
the speed of grep/awk for the ability to do more complex searches.

http://swtch.com/~rsc/regexp/regexp1.html

This might not be your problem but if it is you can always popen grep.

It would be nice if there were a Thompson NFA re module.

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


Re: Regex Speed

2007-02-21 Thread Pop User
John Machin wrote:
 Or a Glushkov NFA simulated by bit parallelism re module ... see
 http://citeseer.ist.psu.edu/551772.html
 (which Russ Cox (author of the paper you cited) seems not to have
 read).
   
NR-grep looks interesting, I'll read that. Thanks.
 Cox uses a pathological regex (regex = a? * 29 + a * 29, in
 Python code) to make his point: grep uses a Thompson gadget and takes
 linear time, while Python perl and friends use backtracking and go off
 the planet.

   
It might be pathological but based on the original posters timings his 
situation seems to relate.
My main point was that its quite possible he isn't going to get faster 
than grep regardless of
the language he uses and if grep wins, use it.  I frequently do. 

 Getting back to the It would be nice ... bit: yes, it would be nice
 to have even more smarts in re, but who's going to do it? It's not a
 rainy Sunday afternoon job :
One of these days.  :)



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


Using printf in a C Extension

2005-12-08 Thread user
Hi,


I am extending python with C and trying to debug with printf.   The code 
below succssfully returns the string hello when compiled and called, 
but the can print from in here phrase does not reach python stdout. 
Is there something screwy with my environment or is there some trick to 
this that I don't know.  Any help would be greatly appreciated!


-mike


#include Python.h


static PyObject*
helloworld(PyObject* self)
{
 printf(can print from in here?);
 return Py_BuildValue(s, hello);
}


static char hw_docstr[] = hello docstr;


static PyMethodDef hw_funcs[] = {
 {helloworld, (PyCFunction)helloworld, METH_NOARGS, hw_docstr},
 {NULL}
};


void
inithelloworld(void)
{
 Py_InitModule3(helloworld,hw_funcs, simple module);
}
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Retrieving and saving images from internet address

2005-07-25 Thread user
rock69 wrote:
 Hi all :)
 
 I got this address:
 
 http://www.infomedia.it/immagini/riviste/covers/cp/cp137.jpg
 
 and I would like to download that image and save it to a local file.
 How do you do that in Python?

I'd use urllib.urlretrieve, Copy a network object denoted by a URL to a 
local file, if necessary.

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


Re: Xah's edu corner: on Microsoft hatred

2005-07-19 Thread Default User
J|rgen Exner wrote:

 
 Just for the records at Google et.al. in case someone stumbles across
 Xah's masterpieces in the future:
 Xah is very well known as the resident troll in many NGs and his
 'contributions' are less then useless.
 
 Best is to just ignore him.


I already had him killfiled. I'm going to add a few of these
non-comp.lang.c newsgroups as well, not due to any animosity towards
them but because I don't read them and don't plan to, so any message
crossed to them is likely a troll.

A good newsreader and aggressive use of filtering is the best way to
handle such people.



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


Re: What is Expresiveness in a Computer Language?

2005-07-11 Thread Default User


Randy Howard wrote:
 Keith Thompson wrote
 (in article [EMAIL PROTECTED]):


 \/|  |\|   __\,,\ /,,/__
  \||/ |  | |  jgs (__Y__)
  /\/\/\/\/\/\/\/\//\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
  ==

 Out of curiosity, does anyone remember who 'jgs' refers to
 above?


http://en.wikipedia.org/wiki/Joan_Stark



Brian

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


Re: Is Python appropriate for web applications?

2005-04-16 Thread Unknown User
Thank you very much.
On Fri, 15 Apr 2005 06:47:14 -0300, Peter Maas [EMAIL PROTECTED] wrote:
Unknown User schrieb:
I am a Python programmer and I'm thinking about learning PHP, which is
similar to C++
wrong
(quite  different from Python).
true
I want to start writing web applications. Do  you  think if I learn
  PHP I'll develop faster?
Nobody but you can anawer this question. You'll have to try.
Does PHP have more features?
PHP has a rich library which probably outperforms any Python alternative
in terms of features. But this doesn't necessarily mean that you will
develop faster in PHP. The problem with Python is that you have to make
a choice among many solutions (roughly ordered by inreasing complexity):
- plain cgi
- Quixote
- modpython
- CherryPy
- Spice
- Webware
- Twisted
- ZOPE
...
Have a look at http://www.python.org/topics/web/
How about the speed  of execution?
There is no simple answer. Both languages use C functions which are
executed at CPU speed. But with interpreted code Python seems to be
approximately 3-4 times faster than PHP (http://dada.perl.it/shootout/).
What are the pros and cons?
http://www.allsites.com/Top.Computers.Programming.Languages.Comparison_and_Review.html

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
--
http://mail.python.org/mailman/listinfo/python-list


Is Python appropriate for web applications?

2005-04-14 Thread Unknown User
I am a Python programmer and I'm thinking about learning PHP, which is  
similar to C++ (quite
different from Python). I want to start writing web applications. Do you  
think if I learn
PHP I'll develop faster? Does PHP have more features? How about the speed  
of execution? What
are the pros and cons? Our server can run both Python, Perl and PHP, so I  
have the choice.
Thanks for your opinion,

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
--
http://mail.python.org/mailman/listinfo/python-list