ANN: A new version (0.3.8) of python-gnupg has been released.

2015-09-26 Thread Vinay Sajip
A new version of the Python module which wraps GnuPG has been

released. 

What Changed? 
= 
This is an enhancement and bug-fix release, and all users are encouraged to 
upgrade.
See the project website [1] for more information.

Brief summary: 


* Fixed #22: handled PROGRESS messages during verification and signing. 

* Fixed #26: handled PINENTRY_LAUNCHED messages during verification, 
  decryption and key generation. 

* Fixed #28: Allowed a default Name-Email to be computed even when neither of 
  LOGNAME and USERNAME are in the environment. 

* Fixed #29: Included test files missing from the tarball in previous versions. 

* Fixed #39: On Python 3.x, passing a text instead of a binary stream caused
  file decryption to hang due to a UnicodeDecodeError. This has now been
  correctly handled: The decryption fails with a "no data" status. 

* Fixed #41: Handled Unicode filenames correctly by encoding them on 2.x using
  the file system encoding.

* Fixed #43: handled PINENTRY_LAUNCHED messages during key export. Thanks to
  Ian Denhardt for looking into this. 

* Hide the console window which appears on Windows when gpg is spawned.
  Thanks to Kévin Bernard-Allies for the patch. 

* Subkey fingerprints are now captured. 

* The returned value from the list_keys method now has a new attribute,
  key_map, which is a dictionary mapping key and subkey fingerprints to
  the corresponding key's dictionary. With this change, you don't need to
  iterate over the (potentially large) returned list to search for a key with
  a given fingerprint - the key_map dict will take you straight to the key
  info, whether the fingerprint you have is for a key or a subkey. Thanks to
  Nick Daly for the initial suggestion. 

This release [2] has been signed with my code signing key: 

Vinay Sajip (CODE SIGNING KEY)  
Fingerprint: CA74 9061 914E AC13 8E66 EADB 9147 B477 339A 9B86 


However, due to some error the signature for the source distribution (.tar.gz)
didn't get uploaded. To rectify this, I have pasted it into the PyPI page for
the release [2].
What Does It Do? 
 
The gnupg module allows Python programs to make use of the 
functionality provided by the Gnu Privacy Guard (abbreviated GPG or 
GnuPG). Using this module, Python programs can encrypt and decrypt 
data, digitally sign documents and verify digital signatures, manage 
(generate, list and delete) encryption keys, using proven Public Key 
Infrastructure (PKI) encryption technology based on OpenPGP. 

This module is expected to be used with Python versions >= 2.4, as it 
makes use of the subprocess module which appeared in that version of 
Python. This module is a newer version derived from earlier work by 
Andrew Kuchling, Richard Jones and Steve Traugott. 

A test suite using unittest is included with the source distribution. 

Simple usage: 

>>> import gnupg 
>>> gpg = gnupg.GPG(gnupghome='/path/to/keyring/directory') 
>>> gpg.list_keys() 

[{ 
... 
'fingerprint': 'F819EE7705497D73E3CCEE65197D5DAC68F1AAB2', 
'keyid': '197D5DAC68F1AAB2', 
'length': '1024', 
'type': 'pub', 
'uids': ['', 'Gary Gross (A test user) ']}, 
{ 
... 
'fingerprint': '37F24DD4B918CC264D4F31D60C5FEFA7A921FC4A', 
'keyid': '0C5FEFA7A921FC4A', 
'length': '1024', 
... 
'uids': ['', 'Danny Davis (A test user) ']}] 
>>> encrypted = gpg.encrypt("Hello, world!", ['0C5FEFA7A921FC4A']) 
>>> str(encrypted) 

'-BEGIN PGP MESSAGE-\nVersion: GnuPG v1.4.9 (GNU/Linux)\n 
\nhQIOA/6NHMDTXUwcEAf 
. 
-END PGP MESSAGE-\n' 
>>> decrypted = gpg.decrypt(str(encrypted), passphrase='secret') 
>>> str(decrypted) 

'Hello, world!' 
>>> signed = gpg.sign("Goodbye, world!", passphrase='secret') 
>>> verified = gpg.verify(str(signed)) 
>>> print "Verified" if verified else "Not verified" 

'Verified' 

As always, your feedback is most welcome (especially bug reports [3], 
patches and suggestions for improvement, or any other points via the 
mailing list/discussion group [4]). 

Enjoy! 

Cheers 

Vinay Sajip 
Red Dove Consultants Ltd. 

[1] https://bitbucket.org/vinay.sajip/python-gnupg 
[2] https://pypi.python.org/pypi/python-gnupg/0.3.8 
[3] https://bitbucket.org/vinay.sajip/python-gnupg/issues 
[4] https://groups.google.com/forum/#!forum/python-gnupg
-- 
https://mail.python.org/mailman/listinfo/python-list


Django (Python Web Framework) Tutorial

2015-09-26 Thread Cai Gengyang
So I am using Mac OS X Yosemite Version 10.10.2, going through the django 
tutorial : https://docs.djangoproject.com/en/1.8/intro/tutorial01/ and learning 
to use it. Am currently on the 2nd chapter "Creating a Project" and got a 
question to ask :

This is the series of steps I took to reach this point :

A) I created a folder called "Weiqi" in my home directory. (named after the 
game I am best at!)

B) Then I typed the command $ cd Weiqi in the "Terminal"

CaiGengYangs-MacBook-Pro:~ CaiGengYang$ cd Weiqi --- input

and got this output :

CaiGengYangs-MacBook-Pro:Weiqi CaiGengYang$ --- output

C) Then I ran the following command in the Terminal : $ django-admin 
startproject mysite.
This created a mysite folder which appeared inside the original Weiqi folder in 
my home directory.
When I clicked on the mysite folder, there is a manage.py file and another 
mysite folder inside the original mysite folder.
When I click on the mysite folder, there are 4 files in it : __init__.py , 
settings.py , urls.py and wsgi.py.

D) The next chapter of the tutorial says this :
"Where should this code live?
If your background is in plain old PHP (with no use of modern frameworks), 
you're probably used to putting code under the Web server's document root (in a 
place such as /var/www). With Django, you don't do that. It's not a good idea 
to put any of this Python code within your Web server's document root, because 
it risks the possibility that people may be able to view your code over the 
Web. That's not good for security.
Put your code in some directory outside of the document root, such as 
/home/mycode."

Question : I am a little confused about the last paragraph : What exactly is a 
"directory outside of the document root, such as /home/mycode." and how do you 
"Put your code in this directory" ?

Thanks a lot !

Appreciate it

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


Re: Fixing Python install on the Mac after running 'CleanMyMac' (fwd)

2015-09-26 Thread Ned Deily
In article ,
 [email protected] wrote:
> I was having this same problem, entered those commands and got this as a 
> response:
> 
> MacBook-Pro:~ kacyjones$ /usr/bin/python2.7 -c 'import 
> numpy;print(numpy.__file__)' 
> /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/num
> py/__init__.pyc
> MacBook-Pro:~ kacyjones$ 
> MacBook-Pro:~ kacyjones$ /usr/bin/python2.7 -c 'import 
> sys;print(sys.version)' 
> 2.7.10 (default, Jul 14 2015, 19:46:27) 
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]
> 
> Any idea what that means for my system?

Since the original reply, Apple has updated the version of the OS X 
10.10.x system Python 2.7 to 2.7.10.  So that looks good.

-- 
 Ned Deily,
 [email protected]

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


Failed to upgrade pip in fresh 2.7 install

2015-09-26 Thread paul . hermeneutic
After a fresh install of Python 2.7 32-bit and 64-bit, upgrading pip
using pip fails. Am I doing this incorrectly? Any suggestions?

C:\Python27-32\Scripts>pip install --upgrade pip
You are using pip version 7.0.1, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip
  Using cached pip-7.1.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 7.0.1
Uninstalling pip-7.0.1:
  Successfully uninstalled pip-7.0.1
Exception:
Traceback (most recent call last):
  File "C:\Python27-32\lib\site-packages\pip\basecommand.py", line 223, in main
logger.debug('Exception information:', exc_info=True)
  File "C:\Python27-32\lib\site-packages\pip\commands\install.py",
line 297, in run
wb = WheelBuilder(
  File "C:\Python27-32\lib\site-packages\pip\req\req_set.py", line
633, in install
for requirement in to_install:
  File "C:\Python27-32\lib\site-packages\pip\req\req_install.py", line
734, in commit_uninstall

  File "C:\Python27-32\lib\site-packages\pip\req\req_uninstall.py",
line 153, in commit
self.save_dir = None
  File "C:\Python27-32\lib\site-packages\pip\_vendor\retrying.py",
line 49, in wrapped_f
return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "C:\Python27-32\lib\site-packages\pip\_vendor\retrying.py",
line 212, in call
raise attempt.get()
  File "C:\Python27-32\lib\site-packages\pip\_vendor\retrying.py",
line 247, in get
six.reraise(self.value[0], self.value[1], self.value[2])
  File "C:\Python27-32\lib\site-packages\pip\_vendor\retrying.py",
line 200, in call
attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "C:\Python27-32\lib\site-packages\pip\utils\__init__.py", line
89, in rmtree
shutil.rmtree(dir, ignore_errors=ignore_errors,
  File "C:\Python27-32\lib\shutil.py", line 247, in rmtree
rmtree(fullname, ignore_errors, onerror)
  File "C:\Python27-32\lib\shutil.py", line 247, in rmtree
rmtree(fullname, ignore_errors, onerror)
  File "C:\Python27-32\lib\shutil.py", line 252, in rmtree
onerror(os.remove, fullname, sys.exc_info())
  File "C:\Python27-32\lib\site-packages\pip\utils\__init__.py", line
101, in rmtree_errorhandler
# use the original function to repeat the operation
WindowsError: [Error 5] Access is denied:
'c:\\users\\pwatson\\appdata\\local\\temp\\pip-4nt07e-uninstall\\python27-32\\scripts\\pip.exe'
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Failed to upgrade pip in fresh 2.7 install

2015-09-26 Thread Joel Goldstick
sudo pip ... etc

On Sat, Sep 26, 2015 at 2:13 PM,  wrote:

> After a fresh install of Python 2.7 32-bit and 64-bit, upgrading pip
> using pip fails. Am I doing this incorrectly? Any suggestions?
>
> C:\Python27-32\Scripts>pip install --upgrade pip
> You are using pip version 7.0.1, however version 7.1.2 is available.
> You should consider upgrading via the 'pip install --upgrade pip' command.
> Collecting pip
>   Using cached pip-7.1.2-py2.py3-none-any.whl
> Installing collected packages: pip
>   Found existing installation: pip 7.0.1
> Uninstalling pip-7.0.1:
>   Successfully uninstalled pip-7.0.1
> Exception:
> Traceback (most recent call last):
>   File "C:\Python27-32\lib\site-packages\pip\basecommand.py", line 223, in
> main
> logger.debug('Exception information:', exc_info=True)
>   File "C:\Python27-32\lib\site-packages\pip\commands\install.py",
> line 297, in run
> wb = WheelBuilder(
>   File "C:\Python27-32\lib\site-packages\pip\req\req_set.py", line
> 633, in install
> for requirement in to_install:
>   File "C:\Python27-32\lib\site-packages\pip\req\req_install.py", line
> 734, in commit_uninstall
>
>   File "C:\Python27-32\lib\site-packages\pip\req\req_uninstall.py",
> line 153, in commit
> self.save_dir = None
>   File "C:\Python27-32\lib\site-packages\pip\_vendor\retrying.py",
> line 49, in wrapped_f
> return Retrying(*dargs, **dkw).call(f, *args, **kw)
>   File "C:\Python27-32\lib\site-packages\pip\_vendor\retrying.py",
> line 212, in call
> raise attempt.get()
>   File "C:\Python27-32\lib\site-packages\pip\_vendor\retrying.py",
> line 247, in get
> six.reraise(self.value[0], self.value[1], self.value[2])
>   File "C:\Python27-32\lib\site-packages\pip\_vendor\retrying.py",
> line 200, in call
> attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
>   File "C:\Python27-32\lib\site-packages\pip\utils\__init__.py", line
> 89, in rmtree
> shutil.rmtree(dir, ignore_errors=ignore_errors,
>   File "C:\Python27-32\lib\shutil.py", line 247, in rmtree
> rmtree(fullname, ignore_errors, onerror)
>   File "C:\Python27-32\lib\shutil.py", line 247, in rmtree
> rmtree(fullname, ignore_errors, onerror)
>   File "C:\Python27-32\lib\shutil.py", line 252, in rmtree
> onerror(os.remove, fullname, sys.exc_info())
>   File "C:\Python27-32\lib\site-packages\pip\utils\__init__.py", line
> 101, in rmtree_errorhandler
> # use the original function to repeat the operation
> WindowsError: [Error 5] Access is denied:
>
> 'c:\\users\\pwatson\\appdata\\local\\temp\\pip-4nt07e-uninstall\\python27-32\\scripts\\pip.exe'
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Failed to upgrade pip in fresh 2.7 install

2015-09-26 Thread Joel Goldstick
On Sat, Sep 26, 2015 at 2:52 PM, Joel Goldstick 
wrote:

> sudo pip ... etc
>
> On Sat, Sep 26, 2015 at 2:13 PM,  wrote:
>
>> After a fresh install of Python 2.7 32-bit and 64-bit, upgrading pip
>> using pip fails. Am I doing this incorrectly? Any suggestions?
>>
>> C:\Python27-32\Scripts>pip install --upgrade pip
>> You are using pip version 7.0.1, however version 7.1.2 is available.
>> You should consider upgrading via the 'pip install --upgrade pip' command.
>> Collecting pip
>>   Using cached pip-7.1.2-py2.py3-none-any.whl
>> Installing collected packages: pip
>>   Found existing installation: pip 7.0.1
>> Uninstalling pip-7.0.1:
>>   Successfully uninstalled pip-7.0.1
>> Exception:
>> Traceback (most recent call last):
>>   File "C:\Python27-32\lib\site-packages\pip\basecommand.py", line 223,
>> in main
>> logger.debug('Exception information:', exc_info=True)
>>   File "C:\Python27-32\lib\site-packages\pip\commands\install.py",
>> line 297, in run
>> wb = WheelBuilder(
>>   File "C:\Python27-32\lib\site-packages\pip\req\req_set.py", line
>> 633, in install
>> for requirement in to_install:
>>   File "C:\Python27-32\lib\site-packages\pip\req\req_install.py", line
>> 734, in commit_uninstall
>>
>>   File "C:\Python27-32\lib\site-packages\pip\req\req_uninstall.py",
>> line 153, in commit
>> self.save_dir = None
>>   File "C:\Python27-32\lib\site-packages\pip\_vendor\retrying.py",
>> line 49, in wrapped_f
>> return Retrying(*dargs, **dkw).call(f, *args, **kw)
>>   File "C:\Python27-32\lib\site-packages\pip\_vendor\retrying.py",
>> line 212, in call
>> raise attempt.get()
>>   File "C:\Python27-32\lib\site-packages\pip\_vendor\retrying.py",
>> line 247, in get
>> six.reraise(self.value[0], self.value[1], self.value[2])
>>   File "C:\Python27-32\lib\site-packages\pip\_vendor\retrying.py",
>> line 200, in call
>> attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
>>   File "C:\Python27-32\lib\site-packages\pip\utils\__init__.py", line
>> 89, in rmtree
>> shutil.rmtree(dir, ignore_errors=ignore_errors,
>>   File "C:\Python27-32\lib\shutil.py", line 247, in rmtree
>> rmtree(fullname, ignore_errors, onerror)
>>   File "C:\Python27-32\lib\shutil.py", line 247, in rmtree
>> rmtree(fullname, ignore_errors, onerror)
>>   File "C:\Python27-32\lib\shutil.py", line 252, in rmtree
>> onerror(os.remove, fullname, sys.exc_info())
>>   File "C:\Python27-32\lib\site-packages\pip\utils\__init__.py", line
>> 101, in rmtree_errorhandler
>> # use the original function to repeat the operation
>> WindowsError: [Error 5] Access is denied:
>>
>> 'c:\\users\\pwatson\\appdata\\local\\temp\\pip-4nt07e-uninstall\\python27-32\\scripts\\pip.exe'
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
>
> sorry, you have windows.  Do you need to be admin?

>
> --
> Joel Goldstick
> http://joelgoldstick.com
>



-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Failed to upgrade pip in fresh 2.7 install

2015-09-26 Thread Zachary Ware
On Sat, Sep 26, 2015 at 1:13 PM,   wrote:
> After a fresh install of Python 2.7 32-bit and 64-bit, upgrading pip
> using pip fails. Am I doing this incorrectly? Any suggestions?

This is a limitation of Windows: you can't replace the executable that
you're currently running.  To work around this, do "python -m pip
install --upgrade pip" instead.  If you have the Python Launcher for
Windows installed (included with Python 3.3+), you can use in place of
'python' in that command, and be very sure about which python's pip is
being upgraded.

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


Python program on induction heating

2015-09-26 Thread Roïya souissi
Hello,
I have realized last year a mini project on induction heating and its 
application onto thermoelectricity. To back up my theoretical work, I created a 
python program ( I used mainly dictionnaries, PIL library and tkinter library). 
I have created a personal blog (https://souissiroiya.wordpress.com/) in a bid 
to publish my future works and projects and his the url to the python program 
in case you want to check it out (https://souissiroiya.wordpress.com/2015 ... 
en-python/).
Best regards,
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ConnectionError handling problem

2015-09-26 Thread Cameron Simpson

On 26Sep2015 09:46, Gonzalo V  wrote:

Hi Cameron.
i had the same problems and you have to tell to python what to do with the
connect problem.


Definitely. That's why we're encouraging him to handle specific exceptions.


try this:
...
except *urllib.error.HTTPError* as e:
   if e.getcode()==504:
   disp = "SIN RESPUESTA DEL SERVIDOR" #(No answer from the
server)
   nombre=''
   origen=''

   precioAhora=''
   print(e.getcode(),disp)
   pass


You're aware that the "pass" there does nothing? Perhaps you're considering 
"continue"?


Normally when I write a specific clause like that it looks a bit like this:

 try this:
   ...
 except *urllib.error.HTTPError* as e:
   if e.getcode()==504:
 warning("about 504 error...")
 nombre = ''
   else:
 raise

This arranges that for _other_ HTTPErrors which I do not correctly handle that 
the exception is reraised.



greeting from Chile. Sorry my english.


Don't apologise. Thank you for working in a second language to accomodate us. I 
apologise for my Spanish, which is nonexistent :-(


Cheers,
Cameron Simpson 


Saludos,
Gonzalo

2015-09-25 3:24 GMT-04:00 Cameron Simpson :


On 24Sep2015 22:46, shiva upreti  wrote:


On Friday, September 25, 2015 at 10:55:45 AM UTC+5:30, Cameron Simpson
wrote:


On 24Sep2015 20:57, shiva upreti  wrote:
>Thank you Cameron.
>I think the problem with my code is that it just hangs without raising
any >exceptions. And as mentioned by Laura above that when I press CTRL+C,
it >just catches that exception and prints ConnectionError which is
definitely >a lie in this case as you mentioned.




Ok. You original code says:

 try:
   r=requests.post(url, data=query_args)
 except:
   print "Connection error"

and presumably we think your code is hanging inside the requests.post
call? You should probably try to verify that, because if it is elsewhere
you need to figure out where (lots of print statements is a first start on
that).

I would open two terminals. Run your program until it hangs in one.

While it is hung, examine the network status. I'll presume you're on a
UNIX system of some kind, probably Linux? If not it may be harder (or just
require someone other than me).

If it is hung in the .post call, quite possibly it has an established
connecion to the target server - maybe that server is hanging.

The shell command:

 netstat -rn | fgrep 172.16.68.6 | fgrep 8090

will show every connection to your server hosting the URL "
http://172.16.68.6:8090/login.xml";. That will tell you if you have a
connection (if you are the only person doing the connecting from your
machine).

If you have the "lsof" program (possibly in /usr/sbin, so
"/usr/sbin/lsof") you can also examine the state of your hung Python
program. This:

 lsof -p 12345

will report on the open files and network connections of the process with
pid 12345. Adjust to suit: you can find your program's pid ("process id")
with the "ps" command, or by backgrounding your program an issuing the
"jobs" command, which should show the process id more directly.


Cheers,
Cameron Simpson 

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


Re: Failed to upgrade pip in fresh 2.7 install

2015-09-26 Thread paul . hermeneutic
Joel, no need for elevated (Administrator) execution. I did need to
follow Zachary's suggestion and it worked well.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Failed to upgrade pip in fresh 2.7 install

2015-09-26 Thread Joel Goldstick
On Sat, Sep 26, 2015 at 6:24 PM,  wrote:

> Joel, no need for elevated (Administrator) execution. I did need to
> follow Zachary's suggestion and it worked well.
>

Good result.  I'm not up on windows for many years


-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Event Handling Error in Python 3.4.3

2015-09-26 Thread Supra1983 Tech
I have a python script for a game and the problem is that after running the 
game, the blocks start falling, but the game over message is not popping up at 
proper times. Here is my script:

import pygame
import time
import random

pygame.init()

display_width = 800
display_height = 600

black = (0,0,0)
white = (255,255,255)
red = (255,0,0)

car_width = 45.2


gameDisplay = pygame.display.set_mode((display_width,display_height))
pygame.display.set_caption('pyrace')
clock = pygame.time.Clock()

carImg = pygame.image.load('theracer 1car.png')

def things_saved(count):
  font = pygame.font.SysFont(None, 25)
  text = font.render("Saved: "+str(count), True, black)
  gameDisplay.blit(text,(0,0))

def things(thingx, thingy, thingw, thingh, color):
pygame.draw.rect(gameDisplay, color, [thingx, thingy, thingw, thingh])
  

def car(x,y):
gameDisplay.blit(carImg,(x,y))

def text_objects(text, font):
  textSurface = font.render(text, True, black)
  return textSurface, textSurface.get_rect()

def message_display(text):
largeText = pygame.font.Font('freesansbold.ttf', 115)
TextSurf, TextRect = text_objects(text, largeText)
TextRect.center = ((display_width/2), (display_height/2))
gameDisplay.blit(TextSurf, TextRect)

pygame.display.update()

time.sleep(2)

game_loop()

def crash():
  message_display('Game Over')

def game_loop():
  x = (display_width * 0.45)
  y = (display_height * 0.45)

  x_change = 0
 
  thing_startx = random.randrange(0, display_width)
  thing_starty = -300
  thing_speed = 7
  thing_width = 100
  thing_height = 100

  saved = 0

  gameExit = False

  while not gameExit:

for event in pygame.event.get():
  if event.type == pygame.QUIT:
pygame.quit()
quit()

  if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
  x_change = -5
elif event.key == pygame.K_RIGHT:
  x_change = 5

  if event.type == pygame.KEYUP:
if event.key == pygame.K_LEFT or event.key == pygame.K_RIGHT:
  x_change = 0
  
x += x_change

gameDisplay.fill(white)

#things(thingx, thingy, thingw, thingh, color)
things(thing_startx, thing_starty, thing_width, thing_height, black)
thing_starty += thing_speed
car(x,y)
things_saved(saved)

if x > display_width - car_width or x < 0:
  crash()

if thing_starty > display_height:
  thing_starty = 0 - thing_height
  thing_startx = random.randrange(0,display_width)
  saved += 1

if y < thing_starty+thing_height:  

  if x > thing_startx and x < thing_startx + thing_width or x+car_width 
  > thing_startx and x + car_width < thing_startx + thing_width:
print('cross')
crash()

pygame.display.update()
clock.tick(60)

game_loop()
pygame.quit()
quit()
  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python program on induction heating

2015-09-26 Thread Steven D'Aprano
Hi, and welcome,

On Sun, 27 Sep 2015 06:28 am, Roïya souissi wrote:

> Hello,
> I have realized last year a mini project on induction heating and its
> application onto thermoelectricity. To back up my theoretical work, I
> created a python program ( I used mainly dictionnaries, PIL library and
> tkinter library). I have created a personal blog
> (https://souissiroiya.wordpress.com/) in a bid to publish my future works
> and projects and his the url to the python program in case you want to
> check it out (https://souissiroiya.wordpress.com/2015 ... en-python/).

Unfortunately that second link is broken and I don't understand enough
French to find it from the home page.



-- 
Steven

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


Re: Python program on induction heating

2015-09-26 Thread MRAB

On 2015-09-27 02:32, Steven D'Aprano wrote:

Hi, and welcome,

On Sun, 27 Sep 2015 06:28 am, Roïya souissi wrote:


Hello,
I have realized last year a mini project on induction heating and its
application onto thermoelectricity. To back up my theoretical work, I
created a python program ( I used mainly dictionnaries, PIL library and
tkinter library). I have created a personal blog
(https://souissiroiya.wordpress.com/) in a bid to publish my future works
and projects and his the url to the python program in case you want to
check it out (https://souissiroiya.wordpress.com/2015 ... en-python/).


Unfortunately that second link is broken and I don't understand enough
French to find it from the home page.




You don't know what "Implémentation en Python" means? Couldn't you make
a guess? :-)

https://souissiroiya.wordpress.com/2015/09/23/implementation-en-python/

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


Re: Django (Python Web Framework) Tutorial

2015-09-26 Thread John Gordon
In <[email protected]> Cai Gengyang 
 writes:

> Question : I am a little confused about the last paragraph : What exactly
> is a "directory outside of the document root, such as /home/mycode." and
> how do you "Put your code in this directory" ?

Django is a web application framework.  So, you have to use it together with
a web server.  The "document root" is the directory where the web server
expects to find files to be served as web pages.

You said you put the Django project code in a subdirectory of your home
directory.  That should be fine.

-- 
John Gordon   A is for Amy, who fell down the stairs
[email protected]  B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"

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


Re: Django (Python Web Framework) Tutorial

2015-09-26 Thread Cai Gengyang
On Sunday, September 27, 2015 at 11:46:13 AM UTC+8, John Gordon wrote:
> In <[email protected]> Cai Gengyang 
>  writes:
> 
> > Question : I am a little confused about the last paragraph : What exactly
> > is a "directory outside of the document root, such as /home/mycode." and
> > how do you "Put your code in this directory" ?
> 
> Django is a web application framework.  So, you have to use it together with
> a web server.  The "document root" is the directory where the web server
> expects to find files to be served as web pages.
> 
> You said you put the Django project code in a subdirectory of your home
> directory.  That should be fine.
> 
> -- 
> John Gordon   A is for Amy, who fell down the stairs
> [email protected]  B is for Basil, assaulted by bears
> -- Edward Gorey, "The Gashlycrumb Tinies"


Ok.

As for the next chapter(Database setup), I opened up mysite/settings.py as per 
the instructions on the Django tutorial.

However, when I try to run the following command : $ python manage.py migrate 
to create the tables in the database,

CaiGengYangs-MacBook-Pro:Weiqi CaiGengYang$ python manage.py migrate  input

I get the following error message :

/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python:
 can't open file 'manage.py': [Errno 2] No such file or directory  output

Any idea how to solve this issue?

Thanks a lot !

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


Re: Failed to upgrade pip in fresh 2.7 install

2015-09-26 Thread eryksun
On 9/26/15, Zachary Ware  wrote:
> On Sat, Sep 26, 2015 at 1:13 PM,   wrote:
>> After a fresh install of Python 2.7 32-bit and 64-bit, upgrading pip
>> using pip fails. Am I doing this incorrectly? Any suggestions?
>
> This is a limitation of Windows: you can't replace the executable that
> you're currently running.

A memory-mapped file can be renamed, so replacing the executable is
doable. The new name has to be on the same volume. That's doable. The
problem is that Windows doesn't allow deleting the file. Maybe pip
could spawn a clean-up script to which it pipes the list of renamed
files. The script waits for pip to exit and then tries to remove the
files.
-- 
https://mail.python.org/mailman/listinfo/python-list