ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: AVL <info@atmsk.ru>
To: mandrake-russian@altlinux.ru
Subject: Re: [mdk-re] Re: скрипт на питоне help!!!
Date: Tue Nov 20 02:02:03 2001
Message-ID: <20011120022451.0070a64d.info@atmsk.ru> (raw)
In-Reply-To: <20011119215720.GC1930@localhost.localdomain>

On Tue, 20 Nov 2001 00:57:20 +0300
Mikhail Zabaluev <mhz@alt-linux.org> wrote:

> Hello AVL,
> 
> On Mon, Nov 19, 2001 at 09:58:47PM +0300, AVL wrote:
> >
> > дописываю тут скриптик на питоне.
> > уперся в гадость.
> > 
> > преобразование типов в следующих строчках не работает.
> > 
> >         StatAfm=os.stat(FileAfm);
> > 	AfmSize=StatAfm[6];
> > 	AfmMtime=StatAfm[8];
> > 	
> >         StatPfb=os.stat(FilePfb);
> > 	PfbSize=StatPfb[6];
> > 	PfbMtime=StatPfb[8];
> > 	
> > 	temp = Font_Xml_Record;
> > 
> > #	temp = string.replace(temp,'%AfmSize%',AfmSize);
> > #	temp = string.replace(temp,'%AfmMtime%',eval(AfmMtime));
> > #	temp = string.replace(temp,'%PfbSize%',eval(StatPfb[6]));
> > #	temp = string.replace(temp,'%PfbMtime%',eval(StatPfb[8]));
> > 
> > вот эти закоментаренные строчки порождают ошибку:
> > 
> > [avl@avl paratype]$ ./GPinst
> > Traceback (most recent call last):
> >   File "./GPinst", line 83, in ?
> >     temp = string.replace(temp,'%AfmSize%',AfmSize);
> >   File "/usr/lib/python2.1/string.py", line 369, in replace
> >     return s.replace(old, new, maxsplit)
> > TypeError: expected a character buffer object
> 
> Похоже, в Font_Xml_Record находится вовсе не строка.

строка :)

Font_Xml_Record='<font format="type1" name="%FullName%" version="%Version%" familyname="%FamilyName%" speciesname="Normal" psname="%Ps_Name%" weight="%Weight%" italicangle="%ItalicAngle%">\n\
    <file type="afm" path="%FileAfm%" size="%AfmSize%" mtime="%AfmMtime%"/>\n\
    <file type="pfb" path="%FilePfb%" size="%PfbSize%" mtime="%PfbMtime%"/>\n\
</font>\n';



StatPfb=os.stat(FilePfb);
PfbSize=StatPfb[6];

а вот в PfbSize - не строка.
а вот так str(PfbSize) - уже строка :)
 
> P.S. А зачем у Вас везде точки с запятой?

это мой первый скрипт. я еще не разобрался и по привычке их налепил.



      reply	other threads:[~2001-11-20  2:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-19 21:36 [mdk-re] " AVL
2001-11-19 21:47 ` Victor Sovetov
2001-11-19 22:37   ` AVL
2001-11-19 22:47     ` AVL
2001-11-20  0:45 ` [mdk-re] " Mikhail Zabaluev
2001-11-20  2:02   ` AVL [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011120022451.0070a64d.info@atmsk.ru \
    --to=info@atmsk.ru \
    --cc=mandrake-russian@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git