how fix the error no2 mange.py

2019-10-28 Thread ankur
Please sir reply me how to fix this problem.
Python is very good language .at I install Django
Poperly   (dijango.admin) is work but not run server.

Sent from Mail for Windows 10

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


Simple Python Quiz To Mark 100th Issue of ImportPython

2016-11-25 Thread Ankur Gupta
Hey Python Programmers,

Import Python Newsletter completed 2 years and 100 issues. Have a simple fun 
python quiz http://importpython.com/newsletter/quiz/ to mark the milestone. 

Happy ThanksGiving day to you all.

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


Re: Simple Python Quiz To Mark 100th Issue of ImportPython

2016-11-25 Thread Ankur Gupta
On Friday, November 25, 2016 at 3:22:30 PM UTC+5:30, Chris Angelico wrote:
> On Fri, Nov 25, 2016 at 8:02 PM, Ankur Gupta  wrote:
> > Import Python Newsletter completed 2 years and 100 issues. Have a simple 
> > fun python quiz http://importpython.com/newsletter/quiz/ to mark the 
> > milestone.
> 
> With your question about laying out code, are you aware that PEP 8
> specifically allows both?
> 
> """
> While sometimes it's okay to put an if/for/while with a small body on
> the same line, never do this for multi-clause statements. Also avoid
> folding such long lines!
> """
> 
> You have a very simple condition (actually, trivially simple - in its
> exact form as given, it's always true) guarding a simple statement.
> There's nothing wrong with putting that on a single line. I especially
> consider this important when there are multiple parallel conditions:
> 
> if foo.x: foo.widen()
> if foo.y: foo.heighten()
> if foo.z: foo.deepen()
> 
> There's no point breaking these into two lines each; they show a
> perfect parallel as it is, and splitting the lines would disrupt that.
> 
> ChrisA

Hey ChrisA,

I see merit in what you are saying. I should probably have used an example with 
multiple statements perhaps to draw a better distinction. My bad. 

Quiz is now out so would be unfair for those who attempted it.

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


Re: Simple Python Quiz To Mark 100th Issue of ImportPython

2016-11-25 Thread Ankur Gupta
On Friday, November 25, 2016 at 6:35:13 PM UTC+5:30, Chris Angelico wrote:
> On Fri, Nov 25, 2016 at 11:21 PM, Ankur Gupta  wrote:
> > Hey ChrisA,
> >
> > I see merit in what you are saying. I should probably have used an example 
> > with multiple statements perhaps to draw a better distinction. My bad.
> >
> > Quiz is now out so would be unfair for those who attempted it.
> 
> Fair enough. What you're showing is how hard it is to pin down the
> term "Pythonic" - while it's easy to decry some forms of code as being
> really bad, there are a lot more that are harder to define, and PEP 8
> specifically says you have to look at context.
> 
> Congrats on the 100 issue milestone, which I forgot to say in my previous 
> post.
> 
> ChrisA

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


Seeking guidance to start a career in python programming

2020-11-04 Thread ankur gupta
Good Morning to All,
My name is Ankur Gupta and I wish to seek guidance from you. I belong to a
non-computer science background but have always been attracted to this
field. I had computer science in class 12th (Where I learned C++ and
Python) but I did Mechanical Engineering instead in college. I wish to
pursue a career in Python programming and therefore undertook 2 online
certification courses in python but besides this, my progress is almost
stalled.

Request you all to please guide how I can move forward with my current
learning of the language and also steps that I can take to pursue a career
in this field.

Once again thanks to you all for your time and consideration and I look
forward to your response


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


fabric.network.disconnect_all()

2015-12-31 Thread Ankur Agrawal
hi team,
I am not sure that disconnect_all() works correctly for task marked as
@parallel

Following is code snippet -

@parallel
def diagnoseTransaction():
with hide('stdout', 'stderr'):
output = run(command)

main.py:

execute(diagnoseTransaction,hosts=hosts_transaction)

disconnect_all()

In the console I see all the commands ran but I never saw
'Disconnecting message' in the console.

While if I remove @parallel decorator and then if I run the same code
then I do see 'Disconnecting messages' in the console.

Am I missing something or ?


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


Error handling with @parallel decorator

2016-01-17 Thread Ankur Agrawal
I am trying to catch Abort exception. When I use fabric's run(...) method,
the host it tries to connect is not available and so it aborts with connect
time out exception. I am not able to catch it. Following is a two different
ways of code snippet-
First I try following  -

class FabricException(Exception):
pass

with settings(abort_exception = FabricException):

try:
output = run(command)
except FabricException:
print 'inside exception'
LOG.debug("inside exception")

It didn't go in exception block. Instead it threw -
NetworkError: Timed out trying to connect to pqaltsnas300.corp.intuit.net
(tried 1 time)
Aborting.
SystemExit: 1

Then I try to continue even if exception -
command  = 'ls -l'
with settings(warn_only = True):
  output = run(command)

Still it threw the same exception
NetworkError: Timed out trying to connect to pqaltsnas300.corp.intuit.net
(tried 1 time)
Aborting.
SystemExit: 1

Appreciate if somebody tell if I am missing anything ?

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


Re: Error handling with @parallel decorator

2016-01-19 Thread Ankur Agrawal
Thanks a lot Steven for your reply. I got the issue, it was my own
FabricException class, when I started using Exception then I could catch
the exception successfully and then I got the type of exception as well by
using your suggested type(err). Your code snippet did help me to find the
issue sooner.

Thanks,
Ankur

On Sun, Jan 17, 2016 at 11:16 PM Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:

> On Monday 18 January 2016 17:15, Ankur Agrawal wrote:
>
> > I am trying to catch Abort exception. When I use fabric's run(...)
> method,
> > the host it tries to connect is not available and so it aborts with
> > connect time out exception. I am not able to catch it. Following is a two
> > different ways of code snippet-
> > First I try following  -
> >
> > class FabricException(Exception):
> > pass
> >
> > with settings(abort_exception = FabricException):
> >
> > try:
> > output = run(command)
> > except FabricException:
> > print 'inside exception'
> > LOG.debug("inside exception")
> >
> > It didn't go in exception block. Instead it threw -
> > NetworkError: Timed out trying to connect to
> pqaltsnas300.corp.intuit.net
> > (tried 1 time)
> > Aborting.
> > SystemExit: 1
>
> Are you sure that the exception is being raised where you think it is being
> raised? You think that it is being raised by run(command), but it is
> possible that the exception is occurring somewhere else?
>
> Don't catch the exception at all, and read the *entire* traceback. It will
> show you what line is raising the error.
>
> Then, surround that line with:
>
> try:
> the line that fails
> except Exception as err:
> print err
> print type(err)
> LOG.debug(err)
> raise
>
> This will tell you exactly what the exception type actually is. Perhaps you
> are trying to catch the wrong thing.
>
> VERY IMPORTANT: catching all exceptions in this way should nearly always
> only be used for debugging purposes. Don't do that in production.
>
> https://realpython.com/blog/python/the-most-diabolical-python-antipattern/
>
>
>
>
> --
> Steve
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC

2014-03-27 Thread tade . ankur

hei , 

I am a newcome to Python. 

I am trying to create a python script which will connect to an SSL URL and 
using the HEAD request will get the status of URL. 

For one the link I am getting following error

[SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record mac 
(_ssl.c:589)

I am using python on windows. 

Following is the code snippet

def checkURLStatusSecure(testhostname,urlsinatest):
global conn, url, res

for url in urlsinatest:
conn = HTTPSConnection(testhostname,'443')
conn.request('HEAD', url)
res = conn.getresponse()
print('|***https://' + testhostname + url + '| %s | %s |' % 
(res.status, res.reason))
res.close()
conn.close()

Any idea why I am gtting the above mentioned error. 

Any help will be appreciable 

Python version in 3.4
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC

2014-04-01 Thread tade . ankur
On Thursday, March 27, 2014 5:40:52 PM UTC+1, tade@gmail.com wrote:
> hei , 
> 
> 
> 
> I am a newcome to Python. 
> 
> 
> 
> I am trying to create a python script which will connect to an SSL URL and 
> using the HEAD request will get the status of URL. 
> 
> 
> 
> For one the link I am getting following error
> 
> 
> 
> [SSL: DECRYPTION_FAILED_OR_BAD_RECORD_MAC] decryption failed or bad record 
> mac (_ssl.c:589)
> 
> 
> 
> I am using python on windows. 
> 
> 
> 
> Following is the code snippet
> 
> 
> 
> def checkURLStatusSecure(testhostname,urlsinatest):
> 
> global conn, url, res
> 
> 
> 
> for url in urlsinatest:
> 
> conn = HTTPSConnection(testhostname,'443')
> 
> conn.request('HEAD', url)
> 
> res = conn.getresponse()
> 
> print('|***https://' + testhostname + url + '| %s | %s |' % 
> (res.status, res.reason))
> 
> res.close()
> 
> conn.close()
> 
> 
> 
> Any idea why I am gtting the above mentioned error. 
> 
> 
> 
> Any help will be appreciable 
> 
> 
> 
> Python version in 3.4


Hei Dave, 

Thanks for taking your time and replying.  

I am getting only the mentioned on the command prompt. Is it possible set some 
traces  and get more information about the errors.

Regards

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


ImportPython Newsletter

2015-05-03 Thread Ankur Gupta
Hey Guys,

Just like to draw attention to ImportPython a weekly Python newsletter. This is 
the 30th issue of the newsletter http://importpython.com/newsletter/no/30/. 
Check out a listing of all Python Books here http://importpython.com/books/

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