Re: [Tutor] Python ASTM Implementation

2015-11-12 Thread Albert-Jan Roskam


> Date: Thu, 12 Nov 2015 16:53:20 +0530
> From: mokshavi...@gmail.com
> To: tutor@python.org
> Subject: [Tutor] Python ASTM Implementation
> 
> Dear All,
> 
> We have a Lab Analyzer(Cobas C311), which we want to interface with Pyhton.
> As you might be knowing that clinical lab analyzers use ASTM protocol.
> Python has a an ASTM module  , but
> I need help in its implementation. In the first place, to my embarrassment
> I could not install it on Linux Mint 15 with Python 2.7.4.
> 
> The following error is coming :
> 
> 
> > /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown
> > distribution option: 'zip_safe'
> >   warnings.warn(msg)
> > /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown
> > distribution option: 'test_suite'
> >   warnings.warn(msg)
> > /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown
> > distribution option: 'install_requires'
> >   warnings.warn(msg)
> > usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
> >or: setup.py --help [cmd1 cmd2 ...]
> >or: setup.py --help-commands
> >or: setup.py cmd --help
> >
> > error: no commands supplied
> >
> 
> And next, cannot figure out how to start. Desperately need your help in
> starting off the coding. I have little experience in Python, but am
> confident that I can pick it up soon if I get help.
> 
> If you feel like, you may direct me to some other links where this type of
> codings have been shown with examples of some sort.

Hi,

Maybe it's setuptools that is too old? Or perhaps pip?
sudo apt-get update
sudo apt-get install --only-upgrade python-setuptools python-pip

I believe it's safer to install Python packages via apt-get if you are using 
the Linux internal Python, rather than using pip.

Albert-Jan




  
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] The very first program in python

2015-11-12 Thread Alan Gauld

On 12/11/15 17:16, Sajjadul Islam wrote:

Hello

I have coded the first snippet in python  - defined a function ,


Give us a clue - show us the code.


getting error if I try call the function from the IDLE window.


If you defined your function in a separate module using IDLE
you can use the run menu to run the module directly. That will
in turn load it into the IDLE shell for you to use.

Alternatively import the module directly in the shell.


///

Traceback (most recent call last):
   File "", line 1, in 
NameError: name 'print_lol' is not defined




print_lol is the name of the function that is declared and defined inside
the file called nester.py and IDLE is called in the same path. What is that
I am missing here ?


Try running nester.py from IDLE.

Alternatively try typing

import nester
nester.print_lol()
or

from nester import print_lol
print_lol()

Its probably worth including a note of OS and Python version
in future posts.

HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python ASTM Implementation

2015-11-12 Thread Alan Gauld

On 12/11/15 11:23, Br. Sayan wrote:


As you might be knowing that clinical lab analyzers use ASTM protocol.


Nope, never heard of ASTM.


Python has a an ASTM module  , but
I need help in its implementation. In the first place, to my embarrassment
I could not install it on Linux Mint 15 with Python 2.7.4.


I note that the most recent release of ASTM (Mar 16 2013)
pre-dates 2.7.4 (Apr 6th 2013) by a week or two.
There is a slight chance that it is incompatible. I can't
see any notes about which Python versions it works with.


The following error is coming :

...

distribution option: 'install_requires'
   warnings.warn(msg)
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: no commands supplied


What did you do to install it?
What commands did you run and from whre?


And next, cannot figure out how to start. Desperately need your help in
starting off the coding. I have little experience in Python, but am
confident that I can pick it up soon if I get help.


I assume you read the home page documentation for ASTM?

http://python-astm.readthedocs.org/en/latest/

You need to provide a bit more detailed info on what you are
doing and what specific issues you want help with. In particular
we need to see the actual code you are running. Thanks for
providing the full error though, that helps a lot.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] The very first program in python

2015-11-12 Thread Mark Lawrence

On 12/11/2015 17:16, Sajjadul Islam wrote:

Hello

I have coded the first snippet in python  - defined a function , then I am
getting error if I try call the function from the IDLE window. The error is
:

Traceback (most recent call last):
   File "", line 1, in 
NameError: name 'print_lol' is not defined

print_lol is the name of the function that is declared and defined inside
the file called nester.py and IDLE is called in the same path. What is that
I am missing here ?

Thanks



You need to either:-

import nester
nester.print_lol()

or:-

from nester import print_lol
print_lol()

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

Mark Lawrence

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] The very first program in python

2015-11-12 Thread Sajjadul Islam
Hello

I have coded the first snippet in python  - defined a function , then I am
getting error if I try call the function from the IDLE window. The error is
:

///

Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'print_lol' is not defined



//

print_lol is the name of the function that is declared and defined inside
the file called nester.py and IDLE is called in the same path. What is that
I am missing here ?



Thanks
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Python ASTM Implementation

2015-11-12 Thread Br. Sayan
Dear All,

We have a Lab Analyzer(Cobas C311), which we want to interface with Pyhton.
As you might be knowing that clinical lab analyzers use ASTM protocol.
Python has a an ASTM module  , but
I need help in its implementation. In the first place, to my embarrassment
I could not install it on Linux Mint 15 with Python 2.7.4.

The following error is coming :


> /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown
> distribution option: 'zip_safe'
>   warnings.warn(msg)
> /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown
> distribution option: 'test_suite'
>   warnings.warn(msg)
> /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown
> distribution option: 'install_requires'
>   warnings.warn(msg)
> usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
>or: setup.py --help [cmd1 cmd2 ...]
>or: setup.py --help-commands
>or: setup.py cmd --help
>
> error: no commands supplied
>

And next, cannot figure out how to start. Desperately need your help in
starting off the coding. I have little experience in Python, but am
confident that I can pick it up soon if I get help.

If you feel like, you may direct me to some other links where this type of
codings have been shown with examples of some sort.

Regards,
Sayan
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] question about descriptors

2015-11-12 Thread Albert-Jan Roskam
> To: tutor@python.org
> From: __pete...@web.de
> Date: Wed, 11 Nov 2015 20:06:20 +0100
> Subject: Re: [Tutor] question about descriptors
> 
> Albert-Jan Roskam wrote:
> 
> >> From: st...@pearwood.info
> 
> >> Fortunately, Python has an mechanism for solving this problem:
> >> the `__getattr__` method and friends.
> >> 
> >> 
> >> class ColumnView(object):
> >> _data = {'a': [1, 2, 3, 4, 5, 6],
> >>  'b': [1, 2, 4, 8, 16, 32],
> >>  'c': [1, 10, 100, 1000, 1, 10],
> >>  }
> >> def __getattr__(self, name):
> >> if name in self._data:
> >> return self._data[name][:]
> >> else:
> >> raise AttributeError
> >> def __setattr__(self, name, value):
> >> if name in self._data:
> >> raise AttributeError('read-only attribute')
> >> super(ColumnView, self).__setattr__(name, value)
> >> def __delattr__(self, name):
> >> if name in self._data:
> >> raise AttributeError('read-only attribute')
> >> super(ColumnView, self).__delattr__(name)
> > 
> > That also seems very straightforward. Why does "if name in self._data:"
> > not cause a recursion? self._data calls __getattr__, which has self._data
> > in it, which...etc.
> 
> __getattr__() is only invoked as a fallback when the normal attribute lookup 
> fails:


Aha.. and "normal attributes" live in self.__dict__?


 
> >>> class A(object):
> ... def __getattr__(self, name):
> ... return self.data[name]
> ... 
> >>> a = A()
> >>> a.data = dict(foo="bar")
> >>> a.foo
> 'bar'
> >>> del a.data
> >>> import sys
> >>> sys.setrecursionlimit(10)
> >>> a.foo
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "", line 3, in __getattr__
>   File "", line 3, in __getattr__
>   File "", line 3, in __getattr__
> RuntimeError: maximum recursion depth exceeded while calling a Python object
> 
> If you need to intercept every attribute lookup use __getattribute__():

Fantastic, thank you for the clear explanation. Do you happen to know whether 
the __getattr__ vs. __getattribute__ distinction was (a) a deliberate design 
decision or (b) a historic anomaly? If one considers the distinction between 
"normal attributes"  vs. "attributes of which the read/write/delete 
properties*) may be changed" , I'd say (a).
 
*) with files these are called "attributes", so one could call them attributes 
with attributes. :-)

> >>> class B(A):
> ... def __getattribute__(self, name):
> ... print "looking for", name
> ... return super(B, self).__getattribute__(name)
> ... 
> >>> b = B()
> >>> b.data = dict(foo="bar")
> >>> b.foo
> looking for foo
> looking for data
> 'bar'
> 
> 
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
  
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 141, Issue 11

2015-11-12 Thread Laura Creighton
In a message of Wed, 11 Nov 2015 17:18:06 +0500, Burhan ul haq writes:
>Continuing "Run Python 2.7 on Android Tablet"
>
>Hi,
>
>I am constrained to install anything on my official laptop, therefore I
>need to have an "online life saver" for Python Learning.
>
>I have already tried "pythonanywhere" but could not get it going, even for
>a basic "hello world" script. I could not locate any basic documentation to
>help me with. The basic help tab "I want to start learning Python
>" bring
>you back to the main dashboard.
>
>Can anybody share a basic how to get started ...
>
>Many Thanks /

That link works for me.
You have to create an account and login before you will be taken
to the page about how to create your account.

Laura


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor