My code won't work if I double click the saved file

2015-07-29 Thread john
I have windows 8 running on my computer and I think I downloaded python 2 and 3 
simultaneously or I think my computer has built in python 2 and I downloaded 
python 3. And now when I ran my code in IDLE, the code works fine but when I 
save my program and double click the save file, it will run but it doesn't 
worked like it used to work in IDLE.

Can someone explain the possible problem I'm currently facing?

I just want my program to run perfectly in both IDLE and when I double click 
the saved file.

I posted my question in stackoverflow but I didn't find an answer.

http://stackoverflow.com/questions/31692156/i-think-my-computer-has-built-in-python-2-and-i-installed-python-3
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What happens when python seeks a text file

2015-07-29 Thread Cameron Simpson

On 29Jul2015 07:52, dieter  wrote:

"=?GBK?B?wO68zsX0?="  writes:

Hi, I tried using seek to reverse a text file after reading about the
subject in the documentation:
https://docs.python.org/3/tutorial/inputoutput.html#methods-of-file-objects
https://docs.python.org/3/library/io.html#io.TextIOBase.seek
...
However, an exception is raised if a file with the same content encoded in
GBK is provided:
$ ./reverse_text_by_seek3.py Moon-gbk.txt
[0, 7, 8, 19, 21, 32, 42, 53, 64]
µÍͷ˼¹ÊÏç
¾ÙÍ·ÍûÃ÷ÔÂ
Traceback (most recent call last):
  File "./reverse_text_by_seek3.py", line 21, in 
print(f.readline(), end="")
UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 8: 
illegal multibyte sequence


The "seek" works on byte level while decoding works on character level
where some characters can be composed of several bytes.

The error you observe indicates that you have "seeked" somewhere
inside a character, not at a legal character beginning.

That you get an error for "gbk" and not for "utf-8" is a bit of
an "accident". The same problem can happen for "utf-8" but the probability
might by sligtly inferior.

Seek only to byte position for which you know that they are also
character beginnings -- e.g. line beginnings.


You may also keep in mind that while you can't do arithmetic on these things 
without knowning the length of the _encoded_ text, what you can do is note the 
value returned by f.tell() whenever you like. If you are reading a text file 
(== an encoding of the text in a specific character set, be it GBK or UTF8) 
then after any read you will be on a character boundary, and can return there.


Actually, on reflection, there may be some character encodings where this is 
not true; I think some encodings of Japanese employ some kind of mode shift 
sequence, so you might need knowledge of those - a plain seek() might not be 
enough. But for any encoding where the character encoded at a spot is 
everything needed then a seek() to any position obtained by tell() should be 
reliable.


In short: line beginnings are not the only places where you can safely seek.  
Though they may be conveniently available.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Use python script to create a part for Abaqus

2015-07-29 Thread saber . chelaghma
Hi all,
I want to create a part in 2D composed by:

-A square
-Inside the square there is a lot of circles

I have a input file .dat where we can find the coordinates of the circles' 
centers and their radius.

I want to create this part using a python script and import it in Abaqus/CAE.

Does anyone have an idea (or examples) on how I can do this ?

Regards,

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


Fwd: Request for Information XML-RPC (Python)

2015-07-29 Thread Davide D'Arenzo
Goodmorning dear Team,

I'm Davide D'Arenzo and I'm working with Python using the standard
xmlrpclib library communicating between a JavaServer (that host xmlrpc
server) and my python client. I have a problem and I hope that you should
solve my issue.

I want to send a DOM instance through xmlrpc protocol. I know that the
istance are impossible to manage by xmlrpclib library in Python but this is
what I need. I'm trying to understand why is not possible to marshal the
class Nodelist and I recognize that the target function is dumps(self,
values) in class Marshaller because she couldn't find this type of Python
Object.

For Instance, the Fault code is this:

Traceback (most recent call last):
  File "testRestSwi.py", line 31, in 
conn.xxx.xxx(dom3,"xxx","xxx")
  File "/usr/lib/python2.7/xmlrpclib.py", line 1224, in __call__
return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1572, in __request
allow_none=self.__allow_none)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1085, in dumps
data = m.dumps(params)
  File "/usr/lib/python2.7/xmlrpclib.py", line 632, in dumps
dump(v, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 654, in __dump
f(self, value, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 756, in dump_instance
self.dump_struct(value.__dict__, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 735, in dump_struct
dump(v, write)
  File "/usr/lib/python2.7/xmlrpclib.py", line 646, in __dump
raise TypeError, "cannot marshal %s objects" % type(value)
TypeError: cannot marshal  objects

Now, I would want to solve this problem and for sure there are many
solutions. But I don't know how to develop or implement something within
the xmlrpclib in order to avoid the "marshalling" problem. Keep in mind
that the file object must be a DOM, is aim, uncheangeable.

For Instance, I'm developing the following:
import xml.dom.minidom as parser
import xmlrpclib
dom3 = parser.parseString("xxx")
conn = xmlrpclib.ServerProxy('xxx',allow_none=True,verbose=True)
conn.xxx.xxx(dom3,"xxx","xxx") #<--- The problem Here.

Might you help me?
Thank you a lot.
-- 
https://mail.python.org/mailman/listinfo/python-list


line error on no. 7

2015-07-29 Thread ltc.hotspot
Hi Everyone,


I'm writing python code to read a data text file, split the file into a list of 
words using the split(function) and to print the results in alphabetical order.


The raw python code is located at http://tinyurl.com/oua9uqx


The sample data is located at 
http://tinyurl.com/odt9nhe



Desired Output: ['Arise', 'But', 'It', 'Juliet', 'Who', 'already', 'and', 
'breaks', 'east', 'envious', 'fair', 'grief', 'is', 'kill', 'light', 'moon', 
'pale', 'sick', 'soft', 'sun', 'the', 'through', 'what', 'window', 'with', 
'yonder']


There is a line error on no. 7
What is the cause of this error?



Regards,
Hal






Sent from Surface-- 
https://mail.python.org/mailman/listinfo/python-list


String Attribute

2015-07-29 Thread ltc.hotspot



Hi Everyone:


What is the source of the syntax error to the String Attribute?



Go to the following URL links and view a copy of the raw data file code and 
sample data: 


1.) http://tinyurl.com/p2xxxhl
2.) http://tinyurl.com/nclg6pq


Here is the desired output:


[email protected]
[email protected]




Hal






Sent from Surface-- 
https://mail.python.org/mailman/listinfo/python-list


Help Command Question

2015-07-29 Thread ltc.hotspot
Hi Everyone,


I'm trying to print a command of list options by using the help command in the 
iPython interpreter. Read captured copy of the printout as follows:



'Python 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 16:44:52) [MSC 
v.
1500 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.


IPython 3.2.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org




In [1]: help list
  File "", line 1
help list
^
SyntaxError: invalid syntax.'


Question: What is the correct help command?





Regards,


Hal


Sent from Surface-- 
https://mail.python.org/mailman/listinfo/python-list


Run Python Script; Nothing Happens

2015-07-29 Thread ryguy7272
I am using Spyder Python 2.7.  I'm running this sample code.
import numpy as np
import numpy.random as npr
import matplotlib.pyplot as plt
S0 = 100
r = 0.05
sigma = 0.25
T = 30 / 365.
I = 1
ST = S0 * np.exp((r - 0.5 * sigma ** 2) * T + sigma * np.sqrt(T) * 
npr.standard_normal(I))
R_gbm = np.sort(ST - S0)
plt.hist(R_gbm, bins=50)
plt.xlabel('absolute return')
plt.ylabel('frequency')
plt.grid(True)

I found it in a book, and I'm trying to run various samples of code, in an 
effort to learn Python.  So, I click the debug button, and this is what I get.
> c:\users\rshuell001\untitled12.py(1)()
-> import numpy as np
(Pdb) 
 
It seems like it doesn't really do anything.  So, I click the exit debug button 
and then click the run button and nothing happens.  I get nothing at all.  In 
the book, the author got a graph.  I get nothing.  I think, and I could be 
totally wrong, Python is sending something to a Console, but I can't tell where 
it goes.  I opened every Console I could find, and I still see nothing 
happening whatsoever.

Any idea what's wrong here?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Run Python Script; Nothing Happens

2015-07-29 Thread Todd
On Wed, Jul 29, 2015 at 3:19 PM, ryguy7272  wrote:

> I am using Spyder Python 2.7.  I'm running this sample code.
> import numpy as np
> import numpy.random as npr
> import matplotlib.pyplot as plt
> S0 = 100
> r = 0.05
> sigma = 0.25
> T = 30 / 365.
> I = 1
> ST = S0 * np.exp((r - 0.5 * sigma ** 2) * T + sigma * np.sqrt(T) *
> npr.standard_normal(I))
> R_gbm = np.sort(ST - S0)
> plt.hist(R_gbm, bins=50)
> plt.xlabel('absolute return')
> plt.ylabel('frequency')
> plt.grid(True)
>
> I found it in a book, and I'm trying to run various samples of code, in an
> effort to learn Python.  So, I click the debug button, and this is what I
> get.
> > c:\users\rshuell001\untitled12.py(1)()
> -> import numpy as np
> (Pdb)
>
> It seems like it doesn't really do anything.  So, I click the exit debug
> button and then click the run button and nothing happens.  I get nothing at
> all.  In the book, the author got a graph.  I get nothing.  I think, and I
> could be totally wrong, Python is sending something to a Console, but I
> can't tell where it goes.  I opened every Console I could find, and I still
> see nothing happening whatsoever.
>
> Any idea what's wrong here?
>
>
First, you need to call plt.show() at the end in order to see anything.

Second, when you run the debugger it immediately waits for you to tell it
what to do.  So you need to tell it continue running.  But normally you
wouldn't run it in the debugger.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Run Python Script; Nothing Happens

2015-07-29 Thread ryguy7272
On Wednesday, July 29, 2015 at 9:19:19 AM UTC-4, ryguy7272 wrote:
> I am using Spyder Python 2.7.  I'm running this sample code.
> import numpy as np
> import numpy.random as npr
> import matplotlib.pyplot as plt
> S0 = 100
> r = 0.05
> sigma = 0.25
> T = 30 / 365.
> I = 1
> ST = S0 * np.exp((r - 0.5 * sigma ** 2) * T + sigma * np.sqrt(T) * 
> npr.standard_normal(I))
> R_gbm = np.sort(ST - S0)
> plt.hist(R_gbm, bins=50)
> plt.xlabel('absolute return')
> plt.ylabel('frequency')
> plt.grid(True)
> 
> I found it in a book, and I'm trying to run various samples of code, in an 
> effort to learn Python.  So, I click the debug button, and this is what I get.
> > c:\users\rshuell001\untitled12.py(1)()
> -> import numpy as np
> (Pdb) 
>  
> It seems like it doesn't really do anything.  So, I click the exit debug 
> button and then click the run button and nothing happens.  I get nothing at 
> all.  In the book, the author got a graph.  I get nothing.  I think, and I 
> could be totally wrong, Python is sending something to a Console, but I can't 
> tell where it goes.  I opened every Console I could find, and I still see 
> nothing happening whatsoever.
> 
> Any idea what's wrong here?

YOU ARE RIGHT!!  THAT WORKED PERFECT!!

I wonder why the author of the book didn't put that in there.

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


How to Calculate NPV?

2015-07-29 Thread ryguy7272
I am using Spyder Python 2.7.  I'm running this sample code.

import scipy as sp
cashflows=[50,40,20,10,50]
npv=sp.npv(0.1,cashflows)
round(npv,2)


Now, I'm trying to get the NPV, and I don't see any obvious way to get it.  
The author of the book that I'm reading gets 144.56.  I think that's wrong, but 
I don't know for sure, as Python won't do any calculation at all.  It's easy to 
enter code and run it, but I can't tell how to get Python to actually DO the 
calculation.

Any idea what I'm doing wrong?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to Calculate NPV?

2015-07-29 Thread Saber Ayoub Chelaghma
On Wednesday, July 29, 2015 at 3:59:10 PM UTC+2, ryguy7272 wrote:
> I am using Spyder Python 2.7.  I'm running this sample code.
> 
> import scipy as sp
> cashflows=[50,40,20,10,50]
> npv=sp.npv(0.1,cashflows)
> round(npv,2)
> 
> 
> Now, I'm trying to get the NPV, and I don't see any obvious way to get it.  
> The author of the book that I'm reading gets 144.56.  I think that's wrong, 
> but I don't know for sure, as Python won't do any calculation at all.  It's 
> easy to enter code and run it, but I can't tell how to get Python to actually 
> DO the calculation.
> 
> Any idea what I'm doing wrong?


Hi,
Just do at the end of your scrip:
print(npv)

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


Re: line error on no. 7

2015-07-29 Thread Jean-Michel Pichavant
- Original Message - 
> From: "ltc hotspot" 
> To: "[email protected]" 
> Sent: Tuesday, 28 July, 2015 10:21:59 PM
> Subject: line error on no. 7
> Hi Everyone,
> I'm writing python code to read a data text file, split the file into
> a list of words using the split(function) and to print the results
> in alphabetical order.
> The raw python code is located at http://tinyurl.com/oua9uqx
> The sample data is located at
> http://tinyurl.com/odt9nhe
> Desired Output: ['Arise', 'But', 'It', 'Juliet', 'Who', 'already',
> 'and', 'breaks', 'east', 'envious', 'fair', 'grief', 'is', 'kill',
> 'light', 'moon', 'pale', 'sick', 'soft', 'sun', 'the', 'through',
> 'what', 'window', 'with', 'yonder']
> There is a line error on no. 7
> What is the cause of this error?

> Regards,
> Hal

> Sent from Surface

Hi,


It's better to post the code with your question.

Python 2.7

fname = raw_input("Enter file name: ")
fh = open(fname)
lst = list()
for line in fh:
if fh == list: continue
list.split()
list.append
sorted("fh") 
print line.rstrip()

The main issue is that you've misspelled 'lst' in the for loop. You've used 
'list' instead. 'list' is a built-in constructor for lists. You cannot split 
it. I'm also not sure what """ if fh == list:continue """ is supposed to 
achieve.

Try the following untested code:

words = []
for line in open(fname): # what if fname does not exist ?
words.extend(line.split())
print sorted(words)
  
Regards,

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Optimizing if statement check over a numpy value

2015-07-29 Thread Heli Nix
On Thursday, July 23, 2015 at 1:43:00 PM UTC+2, Jeremy Sanders wrote:
> Heli Nix wrote:
> 
> > Is there any way that I can optimize this if statement.
> 
> Array processing is much faster in numpy. Maybe this is close to what you 
> want
> 
> import numpy as N
> # input data
> vals = N.array([42, 1, 5, 3.14, 53, 1, 12, 11, 1])
> # list of items to exclude
> exclude = [1]
> # convert to a boolean array
> exclbool = N.zeros(vals.shape, dtype=bool)
> exclbool[exclude] = True
> # do replacement
> ones = vals==1.0
> # Note: ~ is numpy.logical_not
> vals[ones & (~exclbool)] = 1e-20
> 
> I think you'll have to convert your HDF array into a numpy array first, 
> using numpy.array().
> 
> Jeremy

Dear all, 

I tried the sorted python list, but this did not really help the runtime. 

I haven´t had time to check the sorted collections.  I solved my runtime 
problem by using the script from Jeremy up here. 

It was a life saviour and it is amazing how powerful numpy is. Thanks a lot 
Jeremy for this. By the way, I did not have to do any array conversion. The 
array read from hdf5 file using h5py is already a numpy array. 

The runtime over an array of around 16M reduced from around 12 hours (previous 
script) to 3 seconds using numpy on the same machine. 


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


Re: Send data to asyncio coroutine

2015-07-29 Thread Javier
El miércoles, 29 de julio de 2015, 1:07:22 (UTC+2), Ian  escribió:
> On Tue, Jul 28, 2015 at 1:17 PM, Javier  wrote:
> > Hello again. I have been investigating a bit your example. I don't 
> > understand why I can't write something like this:
> >
> > 
> >
> > import asyncio
> >
> > def foo():
> > print("start foo")
> > try:
> > while True:
> > val = yield
> > print("foo:", val)
> > yield from asyncio.sleep(3)
> > except GeneratorExit:
> > print("foo closed")
> > print("exit foo")
> >
> > def bar(next):
> > print("start bar")
> > next.send(None)
> > try:
> > while True:
> > val = yield
> > next.send("bar/"+val)
> > except GeneratorExit:
> > print("bar closed")
> > print("exit bar")
> >
> > def fun(next):
> > next.send(None)
> > for e in ["hello", "world", "I'm", "pythonist"]:
> > next.send(e)
> >
> > @asyncio.coroutine
> > def run():
> > fun(bar(foo()))
> >
> > loop = asyncio.get_event_loop()
> > loop.run_until_complete(run())
> > loop.close()
> 
> Because "yield from asyncio.sleep(3)" doesn't magically pause the
> coroutine as you want it to. It yields a future, which is meant to be
> yielded back up the coroutine chain to the event loop. The event loop
> would then resume the coroutine once the future is done, which in the
> case of asyncio.sleep will happen after the sleep timer completes.
> 
> In your example, the future never makes it back to the event loop.
> asyncio.sleep yields the future to foo, and since foo is suspended by
> a yield from, foo yields the future to bar, where it is the result of
> the next.send call. The return value of next.send is ignored, so the
> future just gets dropped on the floor at this point. bar yields to
> fun, which sends bar the next string in its list, "world". bar sends
> "world" to foo, and since foo is still suspended by a yield from, it
> sends "world" on to the asyncio.sleep future. Not a new asyncio.sleep
> future, but the same one that it's still yielding from. The future
> then realizes that something is wrong, because its generator code is
> running again but it doesn't have a result yet, so it throws that
> AssertionError.
> 
> If you want the yield from in foo to work properly, then you need to
> make sure that the future gets back to the event loop, and if you do
> that in some tricky way other than a yield from chain, you'll also
> need to make sure that you're not trying to send it more data before
> foo has resumed.
> 
> > I think this is a big flaw in python/asyncio design.
> 
> I don't entirely disagree. I think that the implementation of async
> coroutines on top of synchronous coroutines on top of generators is
> overly clever and results in a somewhat leaky abstraction and a fair
> amount of confusion.



I see, so I was wrong. I used to see event loop, and yield from as a language 
improvement but it's actually a library improvement that, as a side effect, 
prevents you from usign some language features like ordinary 
generator/coroutine communication. That is a pity. 

Thank you very much for your time and explanations, now I understand some 
points. I'll keep on learning asyncio.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help Command Question

2015-07-29 Thread Jean-Michel Pichavant
- Original Message - 

> From: "ltc hotspot" 
> To: "[email protected]" 
> Sent: Tuesday, 28 July, 2015 6:59:13 PM
> Subject: Help Command Question

> Hi Everyone,

> I'm trying to print a command of list options by using the help
> command in the iPython interpreter. Read captured copy of the
> printout as follows:

> 'Python 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015,
> 16:44:52) [MSC v.
> 1500 64 bit (AMD64)]
> Type "copyright", "credits" or "license" for more information.

> IPython 3.2.0 -- An enhanced Interactive Python.
> Anaconda is brought to you by Continuum Analytics.
> Please check out: http://continuum.io/thanks and https://anaconda.org

> In [1]: help list
> File "", line 1
> help list
> ^
> SyntaxError: invalid syntax.'

> Question: What is the correct help command?

> Regards,

> Hal


These are very basic questions for which you can find the answer with google. 
Did you check the ipython documentation ?

Anyway,

> help(list)

or

> list?

are what you're looking for.

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to Calculate NPV?

2015-07-29 Thread ryguy7272
On Wednesday, July 29, 2015 at 10:21:35 AM UTC-4, ryguy7272 wrote:
> On Wednesday, July 29, 2015 at 9:59:10 AM UTC-4, ryguy7272 wrote:
> > I am using Spyder Python 2.7.  I'm running this sample code.
> > 
> > import scipy as sp
> > cashflows=[50,40,20,10,50]
> > npv=sp.npv(0.1,cashflows)
> > round(npv,2)
> > 
> > 
> > Now, I'm trying to get the NPV, and I don't see any obvious way to get it.  
> > The author of the book that I'm reading gets 144.56.  I think that's wrong, 
> > but I don't know for sure, as Python won't do any calculation at all.  It's 
> > easy to enter code and run it, but I can't tell how to get Python to 
> > actually DO the calculation.
> > 
> > Any idea what I'm doing wrong?
>  
> PERFECT!!  SO SIMPLE!!
> I don't know why the author didn't do that in the book.
> 
> Thanks!

One last thing, for Excel users, leave out the initial CF.  Do the NPV on the 
other CFs, and then add in the initial CF at the end of the NPV function.  It's 
almost like a PV + 1stCF.  I don't know why Excel does it like that...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to Calculate NPV?

2015-07-29 Thread ryguy7272
On Wednesday, July 29, 2015 at 9:59:10 AM UTC-4, ryguy7272 wrote:
> I am using Spyder Python 2.7.  I'm running this sample code.
> 
> import scipy as sp
> cashflows=[50,40,20,10,50]
> npv=sp.npv(0.1,cashflows)
> round(npv,2)
> 
> 
> Now, I'm trying to get the NPV, and I don't see any obvious way to get it.  
> The author of the book that I'm reading gets 144.56.  I think that's wrong, 
> but I don't know for sure, as Python won't do any calculation at all.  It's 
> easy to enter code and run it, but I can't tell how to get Python to actually 
> DO the calculation.
> 
> Any idea what I'm doing wrong?
 
PERFECT!!  SO SIMPLE!!
I don't know why the author didn't do that in the book.

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


Re: Gmail eats Python

2015-07-29 Thread random832
On Sun, Jul 26, 2015, at 02:43, Ian Kelly wrote:
> What Internet standard is being violated by reflowing text content in
> the message body?

Well, implicitly, text is only supposed to be reflowed when
format=flowed is in use, and only then when each physical line of the
file ends with a space character.

If there were _no_ internet standard on reflowing that would be one
thing (new feature whereas the standards are behind the times), but the
standard for reflowing is actually well-established (RFC 2646, dated
1999) and there's no real reason for not following it.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Gmail eats Python

2015-07-29 Thread random832
On Sun, Jul 26, 2015, at 07:48, Marko Rauhamaa wrote:
> At first, there was only the machine language. Assembly languages
> introduced "mnemonics" for the weaklings who couldn't remember the
> opcodes by heart.

To be fair, x86 is also a particularly terrible example of a machine
language, from the perspective of someone imagining being expected to
memorize it. Compare it with PDP-11, which had eight registers and eight
addressing modes and a whole lot less to memorize (since each of these
appears in every instruction as a single octal digit).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Gmail eats Python

2015-07-29 Thread Larry Martell
On Wed, Jul 29, 2015 at 10:51 AM,   wrote:
> On Sun, Jul 26, 2015, at 07:48, Marko Rauhamaa wrote:
>> At first, there was only the machine language. Assembly languages
>> introduced "mnemonics" for the weaklings who couldn't remember the
>> opcodes by heart.
>
> To be fair, x86 is also a particularly terrible example of a machine
> language, from the perspective of someone imagining being expected to
> memorize it. Compare it with PDP-11, which had eight registers and eight
> addressing modes and a whole lot less to memorize (since each of these
> appears in every instruction as a single octal digit).


6809 was the best machine language.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Usage of P(C)ython Logo for Coffee Mug

2015-07-29 Thread Laura Creighton
In a message of Mon, 27 Jul 2015 23:16:26 +0200, deus ex writes:
>Dear sirs or madam,
>
>I would like to let produce a p(c)ython coffee mug for myself for
>non-commerical use. Am I allowed to use your designed logo like:
>
>https://www.python.org/static/community_logos/python-logo-generic.svg
>https://upload.wikimedia.org/wikipedia/de/thumb/c/ce/Cython-logo.svg/640px-Cython-logo.svg.png
>
>or other versions?
>
>If you possibly be so kind to provide me a SVG Version please, that I am
>allowed to modify and use?
>
>Thanks in advance.
>
>Greetings,
>
>dex

You will have to talk to the Cython developers for use of their image --
but I doubt there will be any problem.

We have SVG versions here:
https://www.python.org/community/logos/

Good luck and have fun,
Laura Creighton

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


Re: Python Questions - July 25, 2015

2015-07-29 Thread Laura Creighton
In a message of Tue, 28 Jul 2015 17:45:00 +0100, BartC writes:
>On 28/07/2015 17:12, Steven D'Aprano wrote:
>> On Tue, 28 Jul 2015 07:46 pm, BartC wrote:
>>
>>> (I'm still reeling from the size of that Anaconda download. Apparently
>>> it contains a whole bunch of stuff, nothing to do with numpy, that I
>>> don't need. But one of the listed packages was 'libffi', which is
>>> puzzling. This library lets a C-like language call functions with
>>> runtime-determined argument types. How would that be used in Python?)
>>
>> https://en.wikipedia.org/wiki/Libffi
>
>Yes, I know (I was looking at it myself a few days ago for another 
>project). But while it might be used for implementing some of Python's 
>internals, I was wondering what it was doing in a user-level set of 
>libraries, given that it's mostly a bunch of C code.
>
>Perhaps they were just padding the list to make it look more impressive.

People who use numpy also want to load up their c extensions a
whole lot.  If you have a hunk of C code (a library, ususually) and
you want to call it from your python code, and play with its
objects just like they were python objects, this is one of the
most common ways to do this.

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


Re: How to Calculate NPV?

2015-07-29 Thread duncan smith
On 29/07/15 15:27, ryguy7272 wrote:
> On Wednesday, July 29, 2015 at 10:21:35 AM UTC-4, ryguy7272 wrote:
>> On Wednesday, July 29, 2015 at 9:59:10 AM UTC-4, ryguy7272 wrote:
>>> I am using Spyder Python 2.7.  I'm running this sample code.
>>>
>>> import scipy as sp
>>> cashflows=[50,40,20,10,50]
>>> npv=sp.npv(0.1,cashflows)
>>> round(npv,2)
>>>
>>>
>>> Now, I'm trying to get the NPV, and I don't see any obvious way to get it.  
>>> The author of the book that I'm reading gets 144.56.  I think that's wrong, 
>>> but I don't know for sure, as Python won't do any calculation at all.  It's 
>>> easy to enter code and run it, but I can't tell how to get Python to 
>>> actually DO the calculation.
>>>
>>> Any idea what I'm doing wrong?
>>  
>> PERFECT!!  SO SIMPLE!!
>> I don't know why the author didn't do that in the book.
>>
>> Thanks!
> 
> One last thing, for Excel users, leave out the initial CF.  Do the NPV on the 
> other CFs, and then add in the initial CF at the end of the NPV function.  
> It's almost like a PV + 1stCF.  I don't know why Excel does it like that...
> 

I don't know what Excel does, but the first value shouldn't require any
special treatment, 1.1**0 = 1.

>>> sum([x/(1.1)**i for i, x in enumerate([50,40,20,10,50])])
144.55638276074038
>>>

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


Re: Gmail eats Python

2015-07-29 Thread Laura Creighton
In a message of Tue, 28 Jul 2015 20:35:15 -0700, Rustom Mody writes:
>- I should not have to customize emacs so that CTRL/A, CTRL/E, CTRL/N, and
>CTRL/P continue to work the way they've done since the mid-1970s.
>
>etc etc
>
>¹ emacs 18 dates from around 1992 (!!)

No, the original one was written in 1976.

These control characters are the very basic move characters in emacs.
People have always been free to remap them if they want them to do
something else, but waking up in the morning and discovering that you
cannot move to the front of your current line, to the end ot it, one line
up and one line down  because somebody has changed this ***for everybody***
would get me quite upset, too.

Laura (happy emacs user since 1979)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Questions - July 25, 2015

2015-07-29 Thread BartC

On 29/07/2015 17:13, Laura Creighton wrote:

In a message of Tue, 28 Jul 2015 17:45:00 +0100, BartC writes:

On 28/07/2015 17:12, Steven D'Aprano wrote:



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


Yes, I know (I was looking at it myself a few days ago for another
project). But while it might be used for implementing some of Python's
internals, I was wondering what it was doing in a user-level set of
libraries, given that it's mostly a bunch of C code.

Perhaps they were just padding the list to make it look more impressive.


People who use numpy also want to load up their c extensions a
whole lot.  If you have a hunk of C code (a library, ususually) and
you want to call it from your python code, and play with its
objects just like they were python objects, this is one of the
most common ways to do this.


If it's in the form where you start by writing along the lines of:

 import libffi

then it must be something very different to what I looked at. (Which 
seemed to consists of lots of C files, headers and ASM modules, for 
dozens of different targets and compilers.)


I would also expect a foreign-function interface to be built-in, or to 
have all the details taken care of by an add-on, so that the very low 
level libffi wouldn't figure at all.


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


Re: Gmail eats Python

2015-07-29 Thread Ian Kelly
On Wed, Jul 29, 2015 at 6:42 AM,   wrote:
> On Sun, Jul 26, 2015, at 02:43, Ian Kelly wrote:
>> What Internet standard is being violated by reflowing text content in
>> the message body?
>
> Well, implicitly, text is only supposed to be reflowed when
> format=flowed is in use, and only then when each physical line of the
> file ends with a space character.

An implicit requirement is not a standard. The whole point of having a
standard is to make the requirements formal and explicit.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: AttributeError: LineLogic instance has no attribute 'probe'

2015-07-29 Thread John Gordon
In  Cameron Simpson 
 writes:

> >Since you haven't posted the actual complete code, we can only guess
> >at the problem.
> >
> >My guess is that you have two different definitions of the LineLogic
> >class, one of them lacking the probe attribute.

> Alternatively, if the code he did quote is accurate, he may have not indented 
> the definition of __init__. Example:

>   class LineLogic(object):
>   ''' doc string
>   '''

>   def __init__(self):
>   ...

> This is legal, but wrong. It will result in LineLogic having the default 
> initialisation i.e. nothing, as the __init__ function is not part of the 
> class.

Ooh, I like your guess better.  :-)


-- 
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: String Attribute

2015-07-29 Thread Terry Reedy

On 7/28/2015 7:38 PM, [email protected] wrote:


What is the source of the syntax error to the String Attribute?

Go to the following URL links and view a copy of the raw data file code
and sample data:

1.) http://tinyurl.com/p2xxxhl
2.) http://tinyurl.com/nclg6pq


If you want help here, reduce your code and input to the minimum needed, 
put the input in the code as a string, and if you still do not see the 
problem, post here, along with the traceback.



Here is the desired output:

[email protected] 
[email protected] 


--
Terry Jan Reedy

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


Re: Use python script to create a part for Abaqus

2015-07-29 Thread Terry Reedy

On 7/29/2015 8:12 AM, [email protected] wrote:

Hi all, I want to create a part in 2D composed by:

-A square -Inside the square there is a lot of circles

I have a input file .dat where we can find the coordinates of the
circles' centers and their radius.


You can easily display a square with circles using tkinter.  However, it 
can only export a postscript file that not all postscript readers can read.



I want to create this part using a python script and import it in
Abaqus/CAE. Does anyone have an idea (or examples) on how I can do this ?


What input file formats does Abaqus/CAE recognize?  If you know that, 
you can potentially write a file in the proper format.


--
Terry Jan Reedy

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


how to

2015-07-29 Thread Martin Spasov
Hello,

i have been learning python for the past year and i did a few projects. Now i 
want to step up my game a bit and i want to build a real estate app . Its not 
going to be commercially released, its just for learning. My idea is the 
following, the app can have 2 types of users - brokers that would be able to 
add, remove and edit properties and clients that would be able to search and 
view different properties and send messages that the broker would be able to 
answer through the app. Its not said that i would do all of that in one go, its 
just the plan. Until now all my projects used shelve as my database, so 
everything was in memory and there was no need to share the data between users. 

For example > User A has his own notes , User B has his own notes and so on.

Now i want there to be global database and when a broker updates a property i 
want to update the database so when a user requests the said property it would 
be updated.

What i think i could do is write a socketserver and keep the data in the socket 
server object. then define a protocol and send the data when it is requested.

Or i could use a database like MySQL with ORM like SQLAlchemy and then query 
the database from the server object. If i do that i would still need to come up 
with some sort of protocol to know what to query. 

Can you please give me ur 2 cents, i know that i haven't explained myself very 
clearly and I am sorry about that. Please ask if there is something unclear.

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


Re: Usage of P(C)ython Logo for Coffee Mug

2015-07-29 Thread Terry Reedy

On 7/29/2015 11:55 AM, Laura Creighton wrote:

In a message of Mon, 27 Jul 2015 23:16:26 +0200, deus ex writes:

Dear sirs or madam,

I would like to let produce a p(c)ython coffee mug for myself for
non-commerical use. Am I allowed to use your designed logo like:

https://www.python.org/static/community_logos/python-logo-generic.svg
https://upload.wikimedia.org/wikipedia/de/thumb/c/ce/Cython-logo.svg/640px-Cython-logo.svg.png

or other versions?

If you possibly be so kind to provide me a SVG Version please, that I am
allowed to modify and use?

Thanks in advance.

Greetings,

dex


You will have to talk to the Cython developers for use of their image --
but I doubt there will be any problem.


The image belongs to PSF, not the developers.  I believe the artist who 
donated it was not a developer.



We have SVG versions here:
https://www.python.org/community/logos/


See Guidelines for Use near the bottom, which as an *ask first* link if 
in doubt.  Given that your coffee cup would be suitable for use while 
programming Python, I would expect no difficultly.



--
Terry Jan Reedy

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


Re: How to Calculate NPV?

2015-07-29 Thread Terry Reedy

On 7/29/2015 10:21 AM, ryguy7272 wrote:

On Wednesday, July 29, 2015 at 9:59:10 AM UTC-4, ryguy7272 wrote:

I am using Spyder Python 2.7.  I'm running this sample code.

import scipy as sp
cashflows=[50,40,20,10,50]
npv=sp.npv(0.1,cashflows)
round(npv,2)


Now, I'm trying to get the NPV, and I don't see any obvious way to get it.
The author of the book that I'm reading gets 144.56.  I think that's wrong, but 
I don't know for sure, as Python won't do any calculation at all.  It's easy to 
enter code and run it, but I can't tell how to get Python to actually DO the 
calculation.

Any idea what I'm doing wrong?


PERFECT!!  SO SIMPLE!!
I don't know why the author didn't do that in the book.


The book show you how to calculate things.  It is up to you to display, 
output to a file, or use in further calculation.  I do admit, though, 
that snippets that show how to use an existing function, rather than 
define a new function, might benefit from adding print().


--
Terry Jan Reedy

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


Re: how to

2015-07-29 Thread alister
On Wed, 29 Jul 2015 11:27:48 -0700, Martin Spasov wrote:

> Hello,
> 
> i have been learning python for the past year and i did a few projects.
> Now i want to step up my game a bit and i want to build a real estate
> app . Its not going to be commercially released, its just for learning.
> My idea is the following, the app can have 2 types of users - brokers
> that would be able to add, remove and edit properties and clients that
> would be able to search and view different properties and send messages
> that the broker would be able to answer through the app. Its not said
> that i would do all of that in one go, its just the plan. Until now all
> my projects used shelve as my database, so everything was in memory and
> there was no need to share the data between users.
> 
> For example > User A has his own notes , User B has his own notes and so
> on.
> 
> Now i want there to be global database and when a broker updates a
> property i want to update the database so when a user requests the said
> property it would be updated.
> 
> What i think i could do is write a socketserver and keep the data in the
> socket server object. then define a protocol and send the data when it
> is requested.
> 
> Or i could use a database like MySQL with ORM like SQLAlchemy and then
> query the database from the server object. If i do that i would still
> need to come up with some sort of protocol to know what to query.
> 
> Can you please give me ur 2 cents, i know that i haven't explained
> myself very clearly and I am sorry about that. Please ask if there is
> something unclear.
> 
> Thank you.

Personally i would suggest this would be best served a a web app, then 
the DB can reside on the server & no transfer protocol would be req.
the app could still be written in python using the WSGI interface.




-- 
Saint:  A dead sinner revised and edited.
-- Ambrose Bierce
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Usage of P(C)ython Logo for Coffee Mug

2015-07-29 Thread Zachary Ware
On Wed, Jul 29, 2015 at 2:01 PM, Terry Reedy  wrote:
> On 7/29/2015 11:55 AM, Laura Creighton wrote:
>> We have SVG versions here:
>> https://www.python.org/community/logos/
>
> See Guidelines for Use near the bottom, which as an *ask first* link if in
> doubt.  Given that your coffee cup would be suitable for use while
> programming Python, I would expect no difficultly.

See also http://www.cafepress.com/pydotorg (linked from the logo page
linked above), which includes coffee mugs for both logo styles.

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


Re: My code won't work if I double click the saved file

2015-07-29 Thread Mark Lawrence

On 29/07/2015 08:20, john wrote:

I have windows 8 running on my computer and I think I downloaded python 2 and 3 
simultaneously or I think my computer has built in python 2 and I downloaded 
python 3. And now when I ran my code in IDLE, the code works fine but when I 
save my program and double click the save file, it will run but it doesn't 
worked like it used to work in IDLE.

Can someone explain the possible problem I'm currently facing?

I just want my program to run perfectly in both IDLE and when I double click 
the saved file.

I posted my question in stackoverflow but I didn't find an answer.

http://stackoverflow.com/questions/31692156/i-think-my-computer-has-built-in-python-2-and-i-installed-python-3



Please run your code from a command prompt.  Tell us exactly what you 
expected to happen and what actually happened.  If you get a traceback 
please cut and paste the entire traceback here.  Show us your code, just 
the bit that causes the problem, as cutting the code back to the bare 
minimum often helps you find the problem.  There is advice on how to do 
this here http://sscce.org/


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: Fwd: Request for Information XML-RPC (Python)

2015-07-29 Thread Irmen de Jong
On 29-7-2015 14:52, Davide D'Arenzo wrote:

> I want to send a DOM instance through xmlrpc protocol. I know that the 
> istance are
> impossible to manage by xmlrpclib library in Python but this is what I need. 
> I'm trying
> to understand why is not possible to marshal the class Nodelist and I 
> recognize that the
> target function is dumps(self, values) in class Marshaller because she 
> couldn't find
> this type of Python Object.

One serialized form of a DOM is an XML document. So why not just send the 
XML
document itself?

Just ask the dom for its string/xml form and send that as a string across your 
xml-rpc call.

Irmen

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


Re: String Attribute

2015-07-29 Thread John Strick
fname = raw_input("Enter file name: ")
if len(fname) < 1 : 
fname = "mbox-short.txt"
for line in fname:
line = line.strip()
if not line.startwith('From '): 
  continue
line = line.split()
count = count + 1


You need to actually open the file. (Look up how to do that) The first 'for' 
loop is looping through the file NAME, not the file OBJECT. Also, 
line.startwith() should be line.startswith().

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


Re: Gmail eats Python

2015-07-29 Thread Cameron Simpson

On 29Jul2015 10:51, [email protected]  wrote:

On Sun, Jul 26, 2015, at 07:48, Marko Rauhamaa wrote:

At first, there was only the machine language. Assembly languages
introduced "mnemonics" for the weaklings who couldn't remember the
opcodes by heart.


To be fair, x86 is also a particularly terrible example of a machine
language, from the perspective of someone imagining being expected to
memorize it. Compare it with PDP-11, which had eight registers and eight
addressing modes and a whole lot less to memorize (since each of these
appears in every instruction as a single octal digit).


16 registers - you forget the alternate register set.

Since the UNIX V7 kernel code never made use of them we used to use them as a 
crude messaging system from user space, as what you put there sayed there, 
globally accessible by other users.


Cheers,
Cameron Simpson 

TeX: When you pronounce it correctly to your computer, the terminal may
become slightly moist. - D. E. Knuth.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Gmail eats Python

2015-07-29 Thread Cameron Simpson

On 29Jul2015 18:32, Laura Creighton  wrote:

In a message of Tue, 28 Jul 2015 20:35:15 -0700, Rustom Mody writes:

- I should not have to customize emacs so that CTRL/A, CTRL/E, CTRL/N, and
CTRL/P continue to work the way they've done since the mid-1970s.

etc etc

¹ emacs 18 dates from around 1992 (!!)


No, the original one was written in 1976.

These control characters are the very basic move characters in emacs.
People have always been free to remap them if they want them to do
something else, but waking up in the morning and discovering that you
cannot move to the front of your current line, to the end ot it, one line
up and one line down  because somebody has changed this ***for everybody***
would get me quite upset, too.


Yeah, I'd be annoyed too. I'm a vi user, but use the emacs mode for shell 
command line editing as it is modeless. ^A, ^E, ^P and ^N are really quite 
critical.



Laura (happy emacs user since 1979)


Cheers,
Cameron Simpson  (happy vi user since 1985)

English is a living language, but simple illiteracy is no basis for
linguistic evolution.   - Dwight MacDonald
--
https://mail.python.org/mailman/listinfo/python-list


Re: Gmail eats Python

2015-07-29 Thread Rustom Mody
On Thursday, July 30, 2015 at 6:15:56 AM UTC+5:30, Cameron Simpson wrote:
> On 29Jul2015 18:32, Laura Creighton  wrote:
> >These control characters are the very basic move characters in emacs.
> >People have always been free to remap them if they want them to do
> >something else, but waking up in the morning and discovering that you
> >cannot move to the front of your current line, to the end ot it, one line
> >up and one line down  because somebody has changed this ***for everybody***
> >would get me quite upset, too.
> 
> Yeah, I'd be annoyed too. I'm a vi user, but use the emacs mode for shell 
> command line editing as it is modeless. ^A, ^E, ^P and ^N are really quite 
> critical.
> 
> >Laura (happy emacs user since 1979)
> 
> Cheers,
> Cameron Simpson (happy vi user since 1985)
> 
> English is a living language, but simple illiteracy is no basis for
> linguistic evolution.   - Dwight MacDonald

That footer says it best:
Some stability is expected, also some change.
Finding a sweetspot midway is hard and very necessary

BTW I think python does a better job -- 2→3 transition than most other
long-lived projects.
Emacs is too much on the conservative side.
Haskell is too  much on the 'progress-is-heaven' side.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My code won't work if I double click the saved file

2015-07-29 Thread Cameron Simpson

On 29Jul2015 00:20, john  wrote:

I have windows 8 running on my computer and I think I downloaded python 2 and 3 
simultaneously or I think my computer has built in python 2 and I downloaded 
python 3. And now when I ran my code in IDLE, the code works fine but when I 
save my program and double click the save file, it will run but it doesn't 
worked like it used to work in IDLE.

Can someone explain the possible problem I'm currently facing?

I just want my program to run perfectly in both IDLE and when I double click 
the saved file.

I posted my question in stackoverflow but I didn't find an answer.

http://stackoverflow.com/questions/31692156/i-think-my-computer-has-built-in-python-2-and-i-installed-python-3


This sounds like what is known as a "file association" issue. Your computer's 
desktop is perhaps associating .py files with the python2 executable. I do not 
use Windows, but I believe you can adjust these associations.


However, the first question (to verify that this is the issue) is: if you 
deliberately invoke python2 and execute your code with it, does it behave the 
same way as when you currently double click on the file?


Cheers,
Cameron Simpson 

The mere existence of a problem is no proof of the existence of a solution.
   - Yiddish Proverb
--
https://mail.python.org/mailman/listinfo/python-list


Re: Which GUI?

2015-07-29 Thread Paulo da Silva
On 24-07-2015 19:31, Paulo da Silva wrote:

I'll begin with pyqtgraph. Seems to be simple to start with. Thanks
Chistopher.

Later I'll give a try to bokeh. I'll need to look better at web
applications first. I still don't know if dynamically changing is
possible without the bokeh server. Thanks Laura.

Thank you all who responded.

Paulo

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


Re: Fwd: Request for Information XML-RPC (Python)

2015-07-29 Thread dieter
"Davide D'Arenzo"  writes:

> I'm Davide D'Arenzo and I'm working with Python using the standard
> xmlrpclib library communicating between a JavaServer (that host xmlrpc
> server) and my python client. I have a problem and I hope that you should
> solve my issue.
>
> I want to send a DOM instance through xmlrpc protocol. I know that the
> istance are impossible to manage by xmlrpclib library in Python but this is
> what I need.

XML-RPC supports only a very small set of elementary types - and
"DOM instance" does not belong to this set.

Thus, you must ask your server administrator as what type the server
expects to get the XML (this may either by "string" or "binary"; I suppose,
it will be "binary"). You then convert your DOM instance into an
XML document, potentially using an appropriate encoding (likely "utf-8"),
and potentially wrap it into "xmlrpclib"'s "binary" wrapper (in case,
the server expects a binary string).


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


Re: how to

2015-07-29 Thread dieter
Martin Spasov  writes:
> ...
> i want to build a real estate app .
> ...
> Now i want there to be global database and when a broker updates a property i 
> want to update the database so when a user requests the said property it 
> would be updated.
>
> What i think i could do is write a socketserver and keep the data in the 
> socket server object. then define a protocol and send the data when it is 
> requested.
>
> Or i could use a database like MySQL with ORM like SQLAlchemy and then query 
> the database from the server object. If i do that i would still need to come 
> up with some sort of protocol to know what to query. 

I would go the second way.

You mentioned to have a "global" database. This suggests there is also
something "local". While is is possible to let distributed applications
access a "global" database, this usually is a great security risk
(you database communication endpoints are open to anybody - among
others hackers that may try to steal or corrupt your data).
Therefore, you usually use a client server architecture where the
database is hidden behind a server interface. The clients do not
directly connect to the database but to the server interface which in
turn access the database. Part of the server interface is
authentication (who wants my services) and authorization (which access
should I provide to the authenticated user).
Someone else already suggested to implement a web application for your
project. Web application frameworks (such as e.g. "Django") come with
components to easily (and rather safely) implement the common tasks
of authentication and authorization.


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