simulated samba server

2005-03-15 Thread tc
Does anyone know of a module for python which simulates a samba server
(windows fileshare). Instead of sharing a Phisical Device I'd like to
share a database based filesystem which is spread over various numbers
of drives and servers.

Any hints?

TC

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


Re: python reading excel thru ADO ?

2005-03-15 Thread tc
I always used win32com.client to access excel files and parse them,
save them as website, csv and so on.

why exactly is it that u use ado for solving this?

TC

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


Re: simulated samba server

2005-03-15 Thread tc
HTTP isn't a solution. I thought of that also, but I need it to
simulate a drive, because various programs (also such that don't
support webDAV / HTTP) need to access the files on that storage, as if
it where a local or a network drive.

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


Re: simulated samba server

2005-03-15 Thread tc
neither...

I really need a network drive or a shell integration (like virtual cd
drive...)


cheers

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


Re: simulated samba server

2005-03-15 Thread tc
GREAT, thanks that should just do the trick.  Maybe that way i'll
generate a bit more network traffic (because it first transfers the
data from different servers to the linux server and the sends it from
there...) but it actually will work just fine.

thanks alot

cheers tc

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


Re: wxPython vs. pyQt

2005-03-17 Thread tc
Has anyone compiled binaries for qt/pyqt/eric3. i'd really like to try
it. at the moment i work with wxWindows and BoaConstructor which i'm
actually not so happy with. design of gui's with wx is not very
efficient...

so is there already a binary for qt/pyqt/eric3 available or when can i
excpect qt4 to be released?


tc

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


What's up with the PyFX Project??? (ex PyCG nVidia CG implementation)

2005-04-04 Thread tc
Does anyone know why there's no progress on the pyfx project??
(http://graphics.cs.lth.se/pyfx)

What are the pro and con's for such an implementation to actually
program a 3d game (engine)??

I started off a while ago in c++ to play around a bit with directx
opengl and cg but I'd rather like to program in a language such as
python...

PyGame doesn't meet my need's because i'd like to take adantage of the
much faster directx technology.

Any comments, hints?

Greets TC

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


Question on importing and function defs

2008-03-02 Thread TC
I have a problem.  Here's a simplified version of what I'm doing:

I have functions a() and b() in a module called 'mod'.  b() calls a().

So now, I have this program:

from mod import *

def a():
blahblah

b()


The problem being, b() is calling the a() that's in mod, not the new
a() that I want to replace it.  (Both a()'s have identical function
headers, in case that matters.)  How can I fix this?

Thanks for any help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question on importing and function defs

2008-03-02 Thread TC
On Mar 2, 11:37 am, Gary Herron <[EMAIL PROTECTED]> wrote:
> TC wrote:
> > I have a problem.  Here's a simplified version of what I'm doing:
>
> > I have functions a() and b() in a module called 'mod'.  b() calls a().
>
> > So now, I have this program:
>
> > from mod import *
>
> > def a():
> > blahblah
>
> > b()
>
> > The problem being, b() is calling the a() that's in mod, not the new
> > a() that I want to replace it.  (Both a()'s have identical function
> > headers, in case that matters.)  How can I fix this?
>
> > Thanks for any help.
>
> Since b calls mod.a, you could replace mod.a with your new a.  Like
> this:  (Warning, this could be considered bad style because it will
> confuse anyone who examines the mod module in an attempt to understand
> you code.)
>
>   import mod
>
>   def replacement_a():
> ...
>
>   mod.a = replacement_a
>
>   ...
>
> Or another option.  Define b to take, as a parameter, the "a" function
> to call.
>
> In mod:
>
>   def a():
>...
>
>   def b(fn=a):  # to set the default a to call
> ...
>
> And you main program:
>
>   from mod import *
>
>   def my_a():
> ...
>
>   b(my_a)
>
> Hope that helps
>
> Gary Herron

Thanks for the tips, but no luck.  This is for a homework assignment,
so there are a couple of requirements, namely that I can't touch
'mod', and I have to do 'from mod import *' as opposed to 'import
mod'.

So the first method you suggested won't work as written, since the mod
namespace doesn't exist.  I tried a = replacement_a, but b() is still
calling mod's version of a() for some reason.  And because I can't
touch mod, I can't use your second suggestion.

In case I somehow oversimplified, here's the actual relevant code, in
'mod' (actually called 'search').  The first fn is what I've been
calling a(), the second is b().

(lots of stuff...)

def compare_searchers(problems, header,
searchers=[breadth_first_tree_search,
  breadth_first_graph_search,
depth_first_graph_search,
  iterative_deepening_search,
depth_limited_search,
  astar_search]):
def do(searcher, problem):
p = InstrumentedProblem(problem)
searcher(p)
return p
table = [[name(s)] + [do(s, p) for p in problems] for s in
searchers]
print_table(table, header)

def compare_graph_searchers():
compare_searchers(problems=[GraphProblem('A', 'B', romania),
GraphProblem('O', 'N', romania),
GraphProblem('Q', 'WA', australia)],
header=['Searcher', 'Romania(A,B)', 'Romania(O, N)',
'Australia'])


That's the end of the 'search' file.  And here's my program, which
defines an identical compare_searchers() with an added print
statement.  That statement isn't showing up.

from search import *

def compare_searchers(problems, header,
searchers=[breadth_first_tree_search,
  breadth_first_graph_search,
depth_first_graph_search,
  iterative_deepening_search,
depth_limited_search,
  astar_search, best_first_graph_search]):
def do(searcher, problem):
p = InstrumentedProblem(problem)
searcher(p)
return p
table = [[name(s)] + [do(s, p) for p in problems] for s in
searchers]
print 'test'
print_table(table, header)

compare_graph_searchers()
-- 
http://mail.python.org/mailman/listinfo/python-list


Extracting text using Beautifulsoup

2009-10-25 Thread TC

Greetings all.

Working with data from 'http://www.finviz.com/quote.ashx?t=SRS',  I was able 
to  get the info using re, however I thought using Beautifulsoup a more 
elegant approach.

Having a bit of a problem though...

Trying to extract text:

SMA20 -1.77%
SMA50 -9.73%

utilizing attribute body in Average] >


From:
---HTML 
snippet
 title="cssbody=[tooltip_short_bdy] cssheader=[tooltip_short_hdr] 
body=[Distance from 20-Day Simple Moving Average] offsetx=[10] offsety=[20] 
delay=[300]">

  SMA20
 
 
  
   
-1.77%
   
  
 
 title="cssbody=[tooltip_short_bdy] cssheader=[tooltip_short_hdr] 
body=[Distance from 50-Day Simple Moving Average] offsetx=[10] offsety=[20] 
delay=[300]">

  SMA50
 
 
  
   
-9.73%
   
  
 
---HTML 
snippet

Using:

import urllib
from BeautifulSoup import BeautifulSoup
archives_url = 'http://www.finviz.com/quote.ashx?t=SRS'
archives_html = urllib.urlopen(archives_url).read()
soup = BeautifulSoup(archives_html)
t = soup.findAll('table')
for table in t:
   g.write(str(table.name) + '\r\n')
   rows = table.findAll('tr')
   for tr in rows:
   g.write('\r\n\t')
   cols = tr.findAll('td')
   for td in cols:
   ret = str(td.find(name='title'))
   g.write('\t\t' + str(td) + '\r\n')
g.close()

Total failure of course.
Any ideas?
Thanks in advance... 


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


Re: for ... else ?

2007-06-12 Thread Matthieu TC

> > > On 6/12/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote:

> > >> for x in iterable:

> > >>do something with x

> > >> else:

> > >>do something when there are no more x

> >

> > >> You can think the above as:

> >

> > >> while there are still values in iterable:

> > >>do something with the next value

> > >> else:

> > >>do something when there are no more items




Also, if the for loop ends because of a break statement, the else part will 
never be executed..

-mats











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


Re: what is wrong with that r"\"

2007-07-04 Thread Matthieu TC
May I suggest giving the possibility to use any delimiter for a raw string?  
just like in Vi or ruby.

Vi:
 %s_a_b_g  is valid and so is  %s/a/b/g

Ruby:
 %q{dj'\ks'a\'"}   or %q-dj'\ks'a\'"-

So as long as your regex does not use all the valid characters, readability is 
maintained.
-matt


- Original Message 
From: Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]>
To: python-list@python.org
Sent: Wednesday, July 4, 2007 9:27:46 PM
Subject: Re: what is wrong with that r"\"

On Wed, 04 Jul 2007 11:21:14 +, Neil Cerutti wrote:

> If the escaped quotes didn't function in raw strings, I'd be
> unable to construct (with a single notation) a regex that
> included both kinds of quotes at once.
> 
>   re.compile(r"'\"")

Where's the problem!? ::

  re.compile(r"''')

Ah, I see -- readability is the problem.  :-)

Ciao,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list



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