[Tutor] Traffic Network simulator

2005-01-31 Thread Shitiz Bansal
Hi, I need a traffic network simulator(for roads) for my project work.I would prefer the simulator to be in python so that i can reprogram/modify it according to my needs. does anyone know where i can find something of the sort or are there any special modules available which can help me build one

[Tutor] freeze

2005-02-04 Thread Shitiz Bansal
Hi, I intend to create compiled python binaries on linux. I understand that freeze can be used to do this. But I have few doubts i would like to clarify. 1. In the freeze documentation i found the lines: "One tricky issue: Freeze assumes that the Python interpreter and environment you're using t

Re: [Tutor] freeze

2005-02-05 Thread Shitiz Bansal
Hi, Do exe files generated by py2run on linux???i thought it was only for windows. Shitiz --- "Jacob S." <[EMAIL PROTECTED]> wrote: > My two bits. > > 1) Download py2exe found here > http://py2exe.sourceforge.net/ > 2) Make a setup file -- intructions can be found > through above link, I > thi

Re: [Tutor] manipulating a file

2005-02-07 Thread Shitiz Bansal
Hi, I do see a problem. The script is fine, the problem lies else where. Your script is trying to write log.bak to log, it should b other way round. i.e srcfile = open('/var/log/httpd-access.log', 'r') dstfile = open('/var/log/httpd-access.log.bak', 'w') hope that fixes it. About the effici

Re: [Tutor] Iterating over multiple lists- options

2005-02-07 Thread Shitiz Bansal
Hi, My solution might raise purist's eyebrows but here it goes... How about using a try loop every time you read from the list. try: x=list[someno] except: x=nothing(or whatever) This goes on till the all lists start returning none. for shorter lists try throws an index out of range excepti

Re: [Tutor] manipulating a file

2005-02-07 Thread Shitiz Bansal
How about cat log|grep -v -E [[:alnum]]'{2096}'>> log.bak The issue is - will unix shell command be any more efficient than a python script?? Also i used append because i gathered that the user will not want to erase the previous logs. He is free to use a single > if he does. --- Alan Gaul

Re: [Tutor] manipulating a file

2005-02-07 Thread Shitiz Bansal
I aplogise for a typo... Please read the command as: cat log|grep -v -E [[:alnum]]'{2096,}'>> log.bak note the missing comma in the previous command. --- Shitiz Bansal <[EMAIL PROTECTED]> wrote: > > How about >cat log|grep -v -E [[:alnum]]'{2096}

[Tutor] killing a thread

2005-02-22 Thread Shitiz Bansal
Hi, Is there a way to terminate a thread from another thread? Shitiz __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Tutor maillist - Tutor@

[Tutor] Python sizeof()

2005-02-23 Thread Shitiz Bansal
Hi, Is there a python equivalent of c's sizeof function. If not, then what are the typical sizes of the BoundedSemaphore object in python? Shitiz __ Do you Yahoo!? Yahoo! Sports - Sign up for Fantasy Baseball. http://baseball.fantasysports.yaho

[Tutor] threads

2005-02-23 Thread Shitiz Bansal
Hi, I am trying to build a traffic network simulator using python, for my degree project. I need to run at least 5-6000 cars simultaneously.I wanted to run each car in a separate thread. However , after about 400 threads i am unable to create new threads. Here's the code: >>> cars=range(1000) >>

Re: [Tutor] threads

2005-02-23 Thread Shitiz Bansal
the point? Shitiz --- Shitiz Bansal <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to build a traffic network simulator > using > python, for my degree project. > > I need to run at least 5-6000 cars simultaneously.I > wanted to run each car in a separate threa

Re: [Tutor] threads

2005-02-25 Thread Shitiz Bansal
> > Information is at www.stackless.com > > Hugo > > Shitiz Bansal wrote: > > Hi, > > > > I am trying to build a traffic network simulator > using > > python, for my degree project. > > > > I need to run at least 5-6000 cars > simultaneously

Re: [Tutor] threads

2005-02-25 Thread Shitiz Bansal
ating this HCF at the beginning is not going to work. Any comments? --- Shitiz Bansal <[EMAIL PROTECTED]> wrote: > Hi, > Thanx everyone for all your suggestions.I used a > separate thread for every car as I wanted my cars to > run in real time, to coordinate effectively with

Re: [Tutor] 3 questions for my port scanner project

2005-02-27 Thread Shitiz Bansal
> 2. I got a while loop which does the port scan > itself. How can I end > it while its working ? using the break statement anywhere inside the loop will exit the loop. > 3. For some reason the scan is too slow (2-3 seconds > for a port). Is > there a way to make it faster (other port scanner >

Re: [Tutor] How to use threads ?

2005-03-01 Thread Shitiz Bansal
--- Mark Kels <[EMAIL PROTECTED]> wrote: > Can anyone give me a very simple example on thread > programming ? > I looked at some tutorials but they don't really > make sense... > > > Thanks in advance > -- > 1. The day Microsoft makes something that doesn't > suck is probably the > day they st

[Tutor] Re: Online Programming Contest (Python solutions accepted)

2005-03-02 Thread Shitiz Bansal
Hi, some questions need to be addressed. First, is execution time a factor, bcos admittedly python sols r much slowere than c/c++. second, wats the exact conf of python installed on machines checking our sols. i.e. which modules r allowed n which r not. shitiz --- Sridhar <[EMAIL PROTECTED]> wrote:

Re: [Tutor] How to use threads ?

2005-03-02 Thread Shitiz Bansal
le "", line 1, in -toplevel- abcd NameError: name 'abcd' is not defined I am not very sure about the CPU usage of a stopped thread.Perhaps someone from the group can enlighten us. Hope this makes it clear. Cheers, Shitiz --- Mark Kels <[EMAIL PROTECTED]> wrote: >

[Tutor] Linked List

2005-03-04 Thread Shitiz Bansal
Hi, Any body has any idea on how to implement a linked list in python? Ordinary python lists are not quite the same. what i need is a list i can traverse through sequentially without bothering about the indices, as another process is continuously editing this list, by inserting and deleting elemen

Re: [Tutor] Linked List

2005-03-05 Thread Shitiz Bansal
I could not understand what you exactly mean. In order to explain wat my problem is, here is an example code. Its not exactly what I am doing, I am using multiple threads and a rather complicated code so try and understand the sense rather than the code itself. >>> myls=range(50) >>> for i in my

Re: [Tutor] Linked List

2005-03-05 Thread Shitiz Bansal
Got ya, it doesnt however help in my case as inside the for loop also i intend to change the list elements. --- Kent Johnson <[EMAIL PROTECTED]> wrote: > Shitiz Bansal wrote: > > I could not understand what you exactly mean. > > > > In order to explain wat my problem

RE: [Tutor] Acessing files in Windows 2000

2005-03-08 Thread Shitiz Bansal
I faced the same problem once.Dont remember the solution, but it is definitely the slashes which are causing the problem.I couldnt find a specific rule in whole of microsoft documentation, so i assume it has to be hit and try.Try a mix of backslashes n forward slashes till u get there. Whats worse,

[Tutor] How to delete a class instance

2005-03-16 Thread Shitiz Bansal
Hi, How do i delete a class instance in a function running within itself? All the instances of the class are stored in a list, and they need to be deleted after executing their function. However since the list is dynamic, there is no way to know the exact position of the instance within the list.

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Shitiz Bansal
<[EMAIL PROTECTED]> wrote: > Shitiz Bansal wrote: > > Hi, > > How do i delete a class instance in a function > running > > within itself? > > All the instances of the class are stored in a > list, > > and they need to be deleted after executing thei

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Shitiz Bansal
> In the code you have shown, I don't see any need for > the queue. Just create the thread and start it. > I don't think you have to keep a reference to it. > I'm not sure, but I think the thread will be > garbage collected when it completes. (Can anyone > else confirm this?) This does make se

Re: [Tutor] How to delete a class instance

2005-03-16 Thread Shitiz Bansal
--- Danny Yoo <[EMAIL PROTECTED]> wrote: > Ok, this makes sense. Each passenger thread needs > to know about the > queue, because that's the place you want the > passenger to drop out of. > > Lists support a 'remove()' method, so you may be > able to use it. Does it operate like queue.remove(s

[Tutor] print command

2005-03-20 Thread Shitiz Bansal
Now this is so basic, i am feeling sheepish asking about it. I am outputting to the terminal, how do i use a print command without making it jump no newline after execution, which is the default behaviour in python. To clarify: print 1 print 2 print 3 I want output to be 123 whereas by default

[Tutor] Web Browser in Python

2005-08-03 Thread Shitiz Bansal
Hi, I need to program a web browser in python.I dont have any idea of how to start, what i do have is time and willingness to learn.Could anyone direct me to some suitable reference? Shitiz__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best spam

Re: [Tutor] Web Browser in Python

2005-08-03 Thread Shitiz Bansal
Hi, I actually want to create a web-browser on my own. There are so many changes i would like to see in my browser that i felt that i would be better of creating my own rather than trying to modify the existing ones.As for the size of project, I have been pursuing programming as a hobby for years

[Tutor] Remove a number from a string

2005-08-23 Thread Shitiz Bansal
Hi, Suppose i have a string '347 liverpool street'. I want to remove all the numbers coming at the starting of the string. I can think of a few ways but whats the cleanest way to do it?   Shitiz__Do You Yahoo!?Tired of spam? Yahoo! Mail has the best

[Tutor] smtp error

2005-09-06 Thread Shitiz Bansal
does this error make sense to anyone? Traceback (most recent call last): File "C:/Documents and Settings/Administrator/Desktop/lkp.py", line 46, in -toplevel- s.sendmail(msg['From'], i, msg.as_string()) File "C:\Python24\lib\smtplib.py", line 692, in sendmail raise SMTPDataError(code,

[Tutor] File mode r+

2005-09-24 Thread Shitiz Bansal
Hi, I want to update a textfile using the r+ file mode. contents of file: abcd efgh ijkl mnop qrst uvwx yx12 my scripts is: file1=open("aa.txt",'r+') file1.readline() file1.readline() file1.write("1234\n") file1.close() This should replace the third line with 1234. However it does nothing. Mor

Re: [Tutor] File mode r+

2005-09-24 Thread Shitiz Bansal
<[EMAIL PROTECTED]> wrote: At 01:11 AM 9/24/2005, Shitiz Bansal wrote:>Hi,>I want to update a textfile using the r+ file mode.>contents of file:>>abcd>efgh>ijkl>mnop>qrst>uvwx>yx12>>my scripts is:>>file1=open("aa.txt",'r+')&g

Re: [Tutor] File mode r+

2005-09-27 Thread Shitiz Bansal
--- "Michael P. Reilly" <[EMAIL PROTECTED]> wrote: > On 9/24/05, Shitiz Bansal <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > How do i proceed if i am not sure about the number > of characters in the > > fist two lines and want to write

Re: [Tutor] File mode r+

2005-09-30 Thread Shitiz Bansal
x27;) >>> file1.read() 'abcd\n1234\x08\nijkl\nmnop\nqrst\nuvwx\nyx12\n' >>> I find this very very strange. shitiz. --- "Michael P. Reilly" <[EMAIL PROTECTED]> wrote: > On 9/27/05, Shitiz Bansal <[EMAIL PROTECTED]> wrote: > > > >

Re: [Tutor] testing for modules?

2005-10-25 Thread Shitiz Bansal
try: import except: import --- Ed Hotchkiss <[EMAIL PROTECTED]> wrote: > i have a generic script that is using several > modules on windows and linux > boxes. i need to have the scripts test if a module > is installed, and then if > not - then to install the module. can anyone give m

[Tutor] Convert string to file handle

2006-11-27 Thread Shitiz Bansal
Hi, i have a string abc. i need a file handle f pointing to a file which contains this string. is there any way i can achieve this without actually writing the contents to a file and then opening it? for performance reasons i want to run this entire process within the physical memory! Thanks, S

[Tutor] Beautiful Soup

2006-11-29 Thread Shitiz Bansal
Hi, I am using beautiful soup for extracting links from a web page. Most pages use relative links in their pages which is causing a problem. Is there any library to extract complete links or do i have to parse this myself? Thanks, Shitiz Terry Carroll <[EMAIL PROTECTED]> wrote: On Wed, 29 Nov

Re: [Tutor] Beautiful Soup

2006-11-29 Thread Shitiz Bansal
Thanks, urlparse.urljoin did the trick. Akash- the problem with directly prefixing url to the link is that the url most of the times contains not just the page address but also parameters and fragments. Andreas Kostyrka <[EMAIL PROTECTED]> wrote: * Akash [061129 20:54]: > On 11/30/0

[Tutor] Beautiful Soup

2006-12-06 Thread Shitiz Bansal
Hi, I am using beautiful soup to get links from an html document. I found that beautiful Soup changes the & in the links to & due to which some of the links become unusable. Is there any way I could stop this behaviour? Regards, Shitiz - Access over 1 million so

[Tutor] Filesystem vs Database vs Lucene

2007-03-26 Thread Shitiz Bansal
Hi, I need to implement a system which stores Strings(average length 50 chars). For every input String it would need to tell the user wether that string already exists in the system. It would also need to add that input String to the system if it did not exist. It will also be useful to know the

Re: [Tutor] Filesystem vs Database vs Lucene

2007-03-28 Thread Shitiz Bansal
, this is bound to outperform them. It might be blasphemous to say this here but is there an equivalent c library as I am willing to spend an extra amount of time coding for that extra zing in performance. Alan Gauld <[EMAIL PROTECTED]> wrote: "Shitiz Bansal" wrote > I