Re: urllib2 pinger : insight as to use, cause of hang-up?

2005-06-05 Thread Mahesh
Timing it out will probably solve it.

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


Re: urllib2 pinger : insight as to use, cause of hang-up?

2005-06-06 Thread Mahesh
socket.setdefaulttimeout() is what I have used in the past and it has
worked well. I think it is set in the global namespace though I could
be wrong. I think it retains its value within the module it is called
in. If you use it in a different module if will probably get reset
though it is easy enough to test that out.

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


Re: Annoying behaviour of the != operator

2005-06-08 Thread Mahesh
No, why should Python assume that if you use != without supplying a
__ne__ that this is what you want? Without direction it will compare
the two objects which is the default behavior.

So, s != t is True because the ids of the two objects are different.
The same applies to, for example s  t and s  t. Do you want Python to
be smart and deduce that you want to compare one variable within the
object if you don't create __gt__ and __lt__? I do not want Python to
do that.

Regards,
M

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


Re: Annoying behaviour of the != operator

2005-06-08 Thread Mahesh
I understand that what makes perfect sense to me might not make perfect
sense to you but it seems a sane default. When you compare two objects,
what is that comparision based on? In the explicit is better than
implicit world, Python can only assume that you *really* do want to
compare objects unless you tell it otherwise. The only way it knows how
to compare two objects is to compare object identities.

I am against making exceptions for corner cases and I do think making
__ne__ implicitly assume not __eq__ is a corner case.

Maybe you think that it takes this explicit is better than implicit
philosophy too far and acts dumb but I think it is acting consistently.

Cheers,
Mahesh

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


Cross platform distribution of standalone executable

2005-03-27 Thread Mahesh
Hi,

One of my clients does not want the Python VM installed on his
production machine (because it is not a supported IT language) so the
only way I can program in Python and release the application to him is
to make a standalone executable and deploy it. The last time I looked
at something like this, Macmillan installer was a good contender but
now that website seems to be AWOL.

Are there any alternate installers out there? Googling didn't bring up
any other maintained installer.

This installer should be able to build on Windows, Linux and AIX.

Thanks,

Mahesh

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


Re: Python 2.4.1 hang

2005-04-15 Thread Mahesh
Yes, it is stupid but I am debugging some poorly written C++ code so I
cannot change it. It was easier for me to use python to try various
combinations (since the C++ code uses a non-standard re engine). I just
chanced upon the problem and was curious as to what Python was up to.

Thanks for clearing that up.

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


Re: Using python 3 for scripting?

2009-03-22 Thread mahesh

python 2.5 is prefered;

On Mar 22, 7:22 pm, timo.my...@gmail.com (Timo Myyrä) wrote:
 Hi,

 I'll have to do some scripting in the near future and I was
 thinking on using the Python for it. I would like to know which
 version of Python to use? Is the Python 3 ready for use or should
 I stick with older releases?

 Timo

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


libc Sleep api performs a busy waiting

2010-03-08 Thread Mahesh
Hi,

 I am having a problem while using sleep function from libc , the
thread in which i am calling it is getting struck and not allowing
other threads to execute.  Here is a simple code that i am trying to
exeute

import threading
import time
import dl


def dummy1():
a=dl.open('/lib/libc.so.6')
print in thread 1 Start
a.call('sleep',2)
#time.sleep(2)
print in thread 1 End

def dummy2():
print in thread 2 Start
time.sleep(1)
print in thread 2 End
newThread1=threading.Thread(None,dummy1)
newThread2=threading.Thread(None,dummy2)
newThread1.start()
newThread2.start()

print in main



The out put of this program is  (In this case thread 1 even though i
am calling a sleep function its not allowing other threads to execute,
other threads execute only after the completion of first thread)

in thread 1 Start
in thread 1 End
in thread 2 Start
in main
in thread 2 End


where as if i use time.sleep instead of a.call(sleep) the out put is
(which i guess is right behaviour, because it start the threads and
suspends them because the have sleep , and continue executing the main
thread)
in thread 1 Start
in thread 2 Start
in main
in thread 2 End
in thread 1 End


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


Re: Perl's documentation come of age

2005-10-05 Thread Mahesh Padmanabhan
In article [EMAIL PROTECTED],
 Xah Lee [EMAIL PROTECTED] wrote:

snip lot of drivel

While I don't like to feed the trolls, I do find his posts amusing. He 
is like a spoilt child seeking attention.

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


Re: ANN: Leo 4.4a1 released

2005-10-17 Thread Mahesh Padmanabhan
In article [EMAIL PROTECTED],
 Edward K. Ream [EMAIL PROTECTED] wrote:

[Edward's announcement]

Thanks for adding Emacs functionality. I really like the idea of 
literate programming and have tried to get into Leo but believe it or 
not, I haven't been able to get into it due to my muscle memory for 
Emacs keystrokes!

I would keep installing Leo only to uninstall it afterwards because I 
would get frustrated.

Another welcome change is complete keyboard control.

Cheers,
Mahesh

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


Re: Pycon disappointment

2008-03-17 Thread mahesh . prakriya
On Mar 16, 7:10 am, Bruce Eckel [EMAIL PROTECTED] wrote:
 If the following seems unnecessarily harsh, it was even more harsh for
 me to discover that the time and money I had spent to get to my
 favorite conference had been sold to vendors, presenting me as a
 captive audience they could pitch to.


Yes, the keynotes were very boring compared to last year. If there's
only one thing ot change, I think sponsorship shouldn't entitle one to
a keynote.

FWIW, tho we sponsored at a Platinum level from Microsoft this year
but we declined to take up on any lightning talks, etc. To me, its
worth sponsoring PyCon (just for Python) irrespective of what we get.
-- 
http://mail.python.org/mailman/listinfo/python-list


need help in adding xlrd file to the dictionary.

2014-04-27 Thread uma mahesh
Hello guys,

I am new to python scripting. I am trying to take data from excel sheet.

To do this I understand that xlrd need to add to the dictionary. I was unable 
to do this. I have downloaded the file and stuck there.

Please let me know how can I do this. tell me the procedure.

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


Please Help to build an addon for Anki

2015-04-20 Thread Mahesh Chiramure
Hi

I liked the addon Picture-flasher written for anki very much
and I was wondering if the same thing could be done with mp3 and/or
flac files. Means I am looking for an addon that chooses a random mp3
and/or flac file from a directory provided by me (to the addon as we
have to provide in Picture-flasher) and plays it on successful
reviewing of a certain number of cards (as does the addon
Picture-flasher). As a music lover, I feel that this addon can
motivate a whole lot of music lovers out there to pay a visit to Anki
on their PC and review to listen to their favorite mp3 and/or flac
files as a reward.

I am not a programmer yet, please guide.

Hoping for a quick response.

Mahesh Chirmure
# -*- coding: utf-8 -*-
# Picture-Flasher (a plugin for Anki)
# Authors:
#   Emanuel Rylke, ema-...@web.de
#   D_Malik, malik6...@gmail.com
# Version 2
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html


A simple plugin that flashes pictures on-screen to reinforce reviews.

Before using:
- Get pictures from someplace. I downloaded pictures off reddit using the 
script at https://github.com/dpbrown/RedditImageGrab
- Change all lines (in the plugin source) marked with CHANGEME according to 
your preferences.

For more details, see the post at For more details, see the post at 
http://lesswrong.com/r/discussion/lw/frc/two_anki_plugins_to_reinforce_reviewing/


from anki.hooks import addHook
from aqt import mw
from random import random, choice
from aqt.qt import QSplashScreen, QPixmap, QTimer
from os import listdir

#-- begin configuration --#
pictureDirectory = E://Family stuff//22 Feb//Personal//College//A J// 
#CHANGEME to the directory where you're storing your pictures. NB: This MUST 
end with a trailing slash e.g. D://Family stuff//19 Jan//Imgs//Wallys//, 
D://Family stuff//22 Feb//Imgs//Windows 7//.

flashTime = 3000 #CHANGEME to change how long pictures stay on the screen. The 
number is time in milliseconds.

#flashPosition = [20, 1050] #CHANGEME if you want the picture to be shown at a 
specific location. The numbers are x- and y-coordinates.

#CHANGEME: The next lines are a python dictionary associating deck names 
with probabilities of pictures being shown.
#Eg, when using the deck brainscience, you will get a picture after 30% 
of cards. When using a deck without a listed name, other is used.
#Change this according to your decks. Decks with shorter, easier cards need 
lower probabilities.
deckPicsProbabilities = {
rocketsurgery:   0.3,
brainscience :   0.5,
other:   0.1,
}
#--- end configuration ---#

pics = listdir(pictureDirectory)

def showPics():
if mw.col.decks.current()['name'] in deckPicsProbabilities:
picsProbability = deckPicsProbabilities[mw.col.decks.current()['name']]
else:
picsProbability = deckPicsProbabilities[other]

if random()  picsProbability:
mw.splash = QSplashScreen(QPixmap(pictureDirectory + choice(pics)))
try:
mw.splash.move(flashPosition[0], flashPosition[1])
except NameError:
pass
mw.splash.show()
QTimer.singleShot(flashTime, mw.splash.close)

addHook(showQuestion, showPics)
-- 
https://mail.python.org/mailman/listinfo/python-list


not able to run python.exe file successsfully

2016-12-23 Thread MAHESH MISHRA
i have installed 3.5.2 version of python my system windows 8.1 64 bit.
after successful installation it is not executing python.exe file.whenever
i try a dialof box pop up with an error message "python has stopped
working". i hav tried reinstalling it several times.please help
-- 
https://mail.python.org/mailman/listinfo/python-list


Extract

2018-05-14 Thread mahesh d
Hii
 I have a directory. In that folder .msg files . How can I extract those
files.


Thanks & regards

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


Extract data

2018-05-15 Thread mahesh d
Hii.

 I have folder.in that folder some files .txt and some files .msg files. .
My requirement is reading those file contents . Extract data in that files .
-- 
https://mail.python.org/mailman/listinfo/python-list


Extract data from multiple text files

2018-05-15 Thread mahesh d
import glob,os

import errno

path = 'C:/Users/A-7993\Desktop/task11/sample emails/'

files = glob.glob(path)

'''for name in files:

print(str(name))

if name.endswith(".txt"):

   print(name)'''

for file in os.listdir(path):

print(file)

if file.endswith(".txt"):

print(os.path.join(path, file))

print(file)

try:

with open(file) as f:

msg = f.read()

print(msg)

except IOError as exc:

if exc.errno != errno.EISDIR:

raise


In the above program . Getting lot of errors . My intention is read the
list of the text files in a folder . Print them


 How can resolve those error
-- 
https://mail.python.org/mailman/listinfo/python-list


Read data from .msg all files

2018-05-15 Thread mahesh d
import glob

import win32com.client



files = glob.glob('C:/Users/A-7993/Desktop/task11/sample emails/*.msg')

for file in files:

print(file)

with open(file) as f:

msg=f.read()

print(msg)

outlook =
win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")

msg = outlook.OpenSharedItem(file)

print("FROM:", str(msg.SenderName))

print(msg.SenderEmailAddress)

print(msg.SentOn)

print(msg.To)

print(msg.CC)

print(msg.BCC)

print(msg.Subject)

print(msg.Body)


How can read all .msg files in a folder. I used outlook.openshared item it
only works one file . How can read the data from .msg files
-- 
https://mail.python.org/mailman/listinfo/python-list


Fetch data from two dates query in python and mongoengine

2018-08-24 Thread mahesh d
Hii
My model like this
class ProcessedEmails(Document):
  subject = StringField(max_length=200)
fromaddress =StringField(max_length=200)
 dateofprocessing = StringField(max_length=25)
How can find out the records between two dates ??
Note: date of processing is string field
 Mongodb database using .
How to write the query in python by using mongoengine

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


Re: Fetch data from two dates query in python and mongoengine

2018-08-24 Thread mahesh d
Thanks!

On Fri 24 Aug, 2018, 9:01 PM Kunal Jamdade, 
wrote:

> Hi Mahesh,
>
> Import Q from queryset.
>
> from mongoengine.queryset.visitor import Q
>
> ProcessedEmails.objects(Q(first_date) & Q(second_date))
>
>
>
> On Fri, Aug 24, 2018 at 12:41 PM mahesh d  wrote:
>
>> [image: Boxbe] <https://www.boxbe.com/overview> This message is eligible
>> for Automatic Cleanup! (mahesh.tec...@gmail.com) Add cleanup rule
>> <https://www.boxbe.com/popup?url=https%3A%2F%2Fwww.boxbe.com%2Fcleanup%3Fkey%3D6shxV8TWSzohw7mx55CRTYGVUY%252F%252FUzgpidJKOL6DPTk%253D%26token%3Di2FjTl%252FO8mAwgqs0qhzOJeuhrkyh9QSqLpzpjt2QGdooZjs2O6iBTYSl%252BJH40Q4ohQceN%252FEvdtQjwBD89TS87YKbX1rR%252BK4ufxoZ7yN4tsFOubjkC91wlF7nlodh1CC8JJheu%252FEGxgpj4VWoEwhlKw%253D%253D_serial=42465772179_rand=687678035_source=stf_medium=email_campaign=ANNO_CLEANUP_ADD_content=001>
>> | More info
>> <http://blog.boxbe.com/general/boxbe-automatic-cleanup?tc_serial=42465772179_rand=687678035_source=stf_medium=email_campaign=ANNO_CLEANUP_ADD_content=001>
>> Hii
>> My model like this
>> class ProcessedEmails(Document):
>>   subject = StringField(max_length=200)
>> fromaddress =StringField(max_length=200)
>>  dateofprocessing = StringField(max_length=25)
>> How can find out the records between two dates ??
>> Note: date of processing is string field
>>  Mongodb database using .
>> How to write the query in python by using mongoengine
>>
>> Thanks
>> Mahesh D.
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: socket.inet_ntop, and pton question

2009-08-05 Thread Mahesh Poojary S



Martin-298 wrote:
 
 Hi
 
 Are these functions (inet_ntop(), inet_pton()) from the socket library 
 supported on Windows.
 
 If not is there an equivalent for them using Windows
 
 Ive seen mention of people creating their own in order to use them
 
 Appreciate the help
 
 ty
 -- 
 http://mail.python.org/mailman/listinfo/python-list
 
 

You can use the below code:
def inet_ntop(address_family, packed_ip):
  if address_family != AF_INET:
raise socket.error, (97, 'Address family not supported by protocol')
  lIP = []
  for ch in packed_ip:
 lIP.append(str(ord(ch)))
  strIP = string.join(lIP,'.')
  return strIP

def inet_pton(address_family, ip_string):
  if address_family != AF_INET:
raise socket.error, (97, 'Address family not supported by protocol')
  lIP = ip_string.split('.')
  strHexIP = 
  for i in lIP:
if i == '':
  continue
strHex = %x % int(i)
strHex = strHex.zfill(2)
strHexIP += \\x+strHex
  return strHexIP

-- 
View this message in context: 
http://www.nabble.com/socket.inet_ntop%2C-and-pton-question-tp8677935p24823395.html
Sent from the Python - python-list mailing list archive at Nabble.com.

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