passing arguments with ampersands

2007-08-18 Thread SHY
 hey,

i have a win32 gui application that accepts filenames as arguments (either
via command line or via associating an extension to the application) which
are then opened in it. the problem is that as soon as the filename contains
characters like '&', the process fails at the very beginning (sys.argv).

for example when the full path of the file im trying to open like this is

Quote:D:\ftp\Music\Mixes & Compilations\Above & Beyond - Essential
Mix\001_Essential_Mix_2004-06-06_-_Above_and_Beyond.txt


when i put 'print sys.argv[1:]' at the very beginning of the script, all i
get is this:

Quote:['D:\\ftp\\Music\\Mixes']



i already have a piece of code that puts together paths with spaces sent via
arguments, but this '&' drives me crazy.

other than that, after i close the application (which actually starts
without any errors), the commands line gets filled with a message like this:


Quote:The system cannot find the path specified.
'Beyond' is not recognized as an internal or external command,
operable program or batch file.



any idea how to solve this? [image: Sad]
thanks in advance!
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: passing arguments with ampersands

2007-08-18 Thread SHY
theres no special portion of code, just the one that handles filenames with
spaces.
the problem is that when i associate a file extension to my application and
i open it, the filename is not quoted before passed as an arguement. i dont
know if its the problem of windows or something, or it was just my fault
when i incorrectly associated the extension.
anyway, this is the code that outputs the second quote i posted in the
original message:

args = None
> if len(sys.argv) > 1:
> args = sys.argv[1:]
>
print args
>

and this is the code that handles the filenames with spaces (as space
generally delimits cmdline params). its not very ellegant, needs a bit of
tuning, but it works (i dont use any kind of -d --something params yet).

[code]
newargs = []
if args:
first = None
for arg in args:
if not first:
first = arg
continue

if os.path.isfile(first):
newargs.append(first)
first = None
continue

if arg.find(":") == -1:
first = " ".join([first, arg])

if first:
newargs.append(first)
[/code]

how can i make the params get quoted before send as arguments?

thanks in advance.



>
> 2007/8/18, O.R.Senthil Kumaran <[EMAIL PROTECTED]>:

> Quote:D:\ftp\Music\Mixes & Compilations\Above & Beyond - Essential
> > Mix\001_Essential_Mix_2004-06-06_-_Above_and_Beyond.txt
>
> > when i put 'print sys.argv[1:]' at the very beginning of the script, all
> i
> > get is this:
> >
> > Quote:['D:\\ftp\\Music\\Mixes']
> >
> Can you share the portion of the code?
> Are you quoting the argument that you are passing?
> for e.g:
>
> #cat 1.py
> import sys
> print sys.argv[1]
>
> #python 1.py "I am able to print the spaces and & characters"
> I am able to print the spaces and & characters
>
> --
> O.R.Senthil Kumaran
> http://uthcode.sarovar.org
>
-- 
http://mail.python.org/mailman/listinfo/python-list

weird edgecolumn behavior in scintilla

2007-08-27 Thread SHY
hey everyone,

i decided its time to heavily improve myself in python-gui programming and
so i started building my own editor/ide for PHP. so far, most of the
general/basic features are inspired (read: mostly copy-pasted) by eric4 IDE
build upon qt4/scintilla combination.

but i came across to a weird problem with the scintilla's edgemodes. when i
set it up to edgeline mode and the edgecolumn is set to 80, the edgeline is
drawn (assuming the default scintilla settings) at approximately 50th
character from the left (and 30th character when the lexer is off - aka txt
files), instead of the expected 80. ive tried to play around with the
lexers' styles to change fonts (courier new, size 10) and stuff but it keeps
drawing the line on 50th column.

ive made a non-elegant and non-pragmatic workaround to this, by setting the
edgecolumn to 128 when the lexer is turned on and 213 when it is off. both
values approximately match the 80th column for courier-new size 10.

i originally thought that the column length for the edgecolumn value is
computed from the character width of the particular font, and so that by
changing the font or its size, the edgecolumn would change appropriately.
dunno if this is the problem of scintilla (cause the exactly same thing is
present in eric4 as well) or i just missed some important setting.

this is the code that handles the edgecolumn stuff when the editor is
launched:

[code]
edgeMode = Preferences.getEditor("EdgeMode")
edge = QsciScintilla.EdgeMode(edgeMode)
self.setEdgeMode(edge)
if edgeMode:
self.setEdgeColumn(Preferences.getEditor("EdgeColumn"))
self.setEdgeColor(Preferences.getEditorColour("Edge"))

[/code]

the EdgeColumn preferences value defaults to 80.

any ideas?

thanks in advance.
SHY
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: passing arguments with ampersands

2007-08-27 Thread SHY
that was the problem. when i manually reassociated the extension, i somehow
didnt quote the argument for the filename. my bad.

thanks for the various explanations and options for this :)

cheers.

2007/8/20, Gabriel Genellina <[EMAIL PROTECTED]>:
>
> En Sat, 18 Aug 2007 09:24:35 -0300, SHY <[EMAIL PROTECTED]> escribi�:
>
> > theres no special portion of code, just the one that handles filenames
> > with
> > spaces.
> > the problem is that when i associate a file extension to my application
> > and
> > i open it, the filename is not quoted before passed as an arguement. i
> > dont
> > know if its the problem of windows or something, or it was just my fault
> > when i incorrectly associated the extension.
>
> How did you associate it?
> Usually the registry entries are:
>
> HKCR\.ext = filetype
> HKCR\filetype = File Description
> HKCR\filetype\shell\open\command = "path\to\your\program" "%1"
>
> (Note the double quotes around %1)
>
> Get it right at the registry, and forget all that trickery joining
> sys.argv parts
>
> --
> Gabriel Genellina
>
> --
> http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

!!! Kausha-s very HOT kiss scene.avi !!!

2010-04-13 Thread "Lou " Shy Amateur Strips
!!! Kausha-s very HOT kiss scene.avi !!!

http://sites.google.com/site/hifiprofile/
http://sites.google.com/site/hifiprofile/

 <<< EXTREME HOT GALLERIES >>>

http://sites.google.com/site/hifiprofile/

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