Re: maybe a bug in python

2005-06-05 Thread =?ISO-8859-1?Q?Tiago_St=FCrmer_Daitx?=
Just as everyone said, use ('a',) instead of ('a'). As Steve said there
are lots of documentation about it. Check the Library Reference at
http://www.python.org/doc/current/lib/typesseq.html#l2h-155 or to make
things more clear you could read the tuples section in the tutorial at
http://docs.python.org/tut/node7.html#SECTION00730

my 2 cents
Regards,
Tiago S Daitx
On 6/5/05, flyaflya [EMAIL PROTECTED] wrote:
  a = {1: (a)}  a[1]'a'why not ('a')? when  a = {1: (((a)))}  a[1]'a'the result is 'a' too,not (((a))).but when use[a] or (a,b),the
tuple is longer than 1, it's no problem.--[http://www.flyaflya.com/]--
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: executing a command

2005-06-04 Thread =?ISO-8859-1?Q?Tiago_St=FCrmer_Daitx?=
Hello,When you use one of the os.exec*p fnnctions python looks
for the specified file in the directories refered by
os.environ['PATH']. If and _only_ if your os.enviroment['PATH'] isn't
set then it looks in os.defpath - you can check this at
http://www.python.org/doc/current/lib/os-path.html#l2h-1557So, my advice is that you first try printing your os.environ['PATH']to
check wheter it includes the program that you are calling or not (and
then you will have to include it). In the case that it isn't set, then
check os.defpath.Also, when you use one of the functions
os.exec that requires a path variable to be passed (ie. the ones that
doesn't have 'p' in their names) the path can be relative or absolute,
but it must include the file name (and not only the dir where the file
is).And for each one of these os.exec* functions the first
argument will always be used as the program name (argv[0]), so unless
you a reason to do otherwise, pass the same name as the file that you
are calling.Regards,Tiago S DaitxOn 6/4/05, andrea valle [EMAIL PROTECTED] wrote: Hi to all, I need to run a program from inside python (substantially, algorithmic
 batch processing). I'm on mac osx 10.3.8 with python 2.3 framework and macpython.  Trying to use exec*, I checked references, Brueck  Tanner, and then grab this code from effbot:
  program = python def run(program, *args): os.execvp(program, (program,) +args) print ok  run(python, /Users/apple/Desktop/prova.py)
  Traceback (most recent call last):File pyshell#50, line 1, in -toplevel-run(python, /Users/apple/Desktop/prova.py)File pyshell#49, line 2, in run
os.execvp(program, (program,) +args)File /System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/os.py, line 336, in execvp_execvpe(file, args)
File /System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/os.py, line 374, in _execvpefunc(fullname, *argrest) OSError: [Errno 45] Operation not supported
  This OSError seems to be consistend with all exec family. What does it mean and how to use exec?  I also tried with. os.system. It works if I invoke python, but it fails (in a way I don't know) when I invoke other programs.
  For example: command = python /Users/apple/Desktop/test.py os.system(command) 0 (test.py write a string in a file. It works)  But with lilypond or with latex I have no output (and in fact it
 doesn't give 0 as result):  command = lilypond /Users/apple/Desktop/test.ly os.system(command) 32512 command = latex /Users/apple/Desktop/test.tex
 os.system(command) 32512  Any help is much appreciated  Thanks a lot  -a-  -- 
http://mail.python.org/mailman/listinfo/python-list 
-- 
http://mail.python.org/mailman/listinfo/python-list

Re:

2005-06-04 Thread =?ISO-8859-1?Q?Tiago_St=FCrmer_Daitx?=
That depends on what using a file means. You could check the thread executing a command (
http://mail.python.org/pipermail/python-list/2005-June/283963.html)
and see if there's something related there, otherwise it would help if
you could post what exactly you are trying to do (execute a file, open
a file, write into a file, etc).

Regards,
Tiago S DaitxOn 6/4/05, Jatinder Singh [EMAIL PROTECTED] wrote:
Hi guysI am working in a complex directory structure. I want to use a file (not .py)which is in some other directory. I couldn't do it.but if I copy the file inthe same directory then it is working fine. Can anybody guide me how and where
to add the path of the file. I have tried it with sys.path but it is not forthat.--Regards,Jatinder Singh" Everyone needs to be loved... especially when they do not deserve it."--
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Looking for help with a python-mode/pdbtrack/gdb patch

2005-06-04 Thread =?ISO-8859-1?Q?Tiago_St=FCrmer_Daitx?=
Unfortunatly the only tip I can give you is that there's a list for
mode-python in http://mail.python.org/mailman/listinfo/python-mode, but
you probably already know about it.

Regards,
Tiago S DaitxOn 6/4/05, Skip Montanaro [EMAIL PROTECTED] wrote:
Can someone who uses Emacs's python-mode, pdbtrack and gdb take a look atthis simple but ancient patch:
http://sourceforge.net/tracker/index.php?func=detailaid=785816group_id=86916atid=581351As you'll see from the discussion, Barry had problems with it from XEmacsand was thinking of rejecting it way back when.I'd like to resolve it one
way or the other, but I've never used pdb, let alone pdbtrack.Thanks,Skip--http://mail.python.org/mailman/listinfo/python-list

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

Re: Importing and source structure troubles

2005-06-03 Thread =?ISO-8859-1?Q?Tiago_St=FCrmer_Daitx?=
The best way depends on how you have structured your program. From
what you've told I believe that setting the directories like
 dir1
dir2
dir3
 
is a good approach.
 
As for the import errors you're getting, check this section from the tutorial:
http://docs.python.org/tut/node8.html#SECTION00840

It describes how to setup packages in Python - and that's exactly what
you need. You'll see that in order to import dir3 from dir2 you must
import the full name of the package (ie. import dir1.dir3). See the
intra-packages reference
http://docs.python.org/tut/node8.html#SECTION00842 
 

Regards,
Tiago S Daitx
On 6/3/05, Echo [EMAIL PROTECTED] wrote:
  Hello,
  
  I am having trouble with putting the source for a program I am working on in 
 different directories.
  I have the directories set up like this:
  
  dir1
dir2
dir3
  
  I want the source in dir2 to be able to import from the source in dir3(is 
 this possible). I get import errors when I tried doing this.
  
  A less preferred structure that I tried was like this:
  dir1
dir3
  dir2
  
  I thought that this way would work. but this way I get even more import 
 errors. two files in dir2 have a 'from dir3.dir2 import bla' however, in one 
 of the files, I get an import error. any idea why this is??
  
  What is the best way to structure the program I am working on? I have 3 
 groups of source files. One has the files that start the program and some 
 tools. Another group has all the main files. And the last group is just some 
 misc stuff. How would the best way to accomplish this be?
  
 -- 
 -Echo  
 --
 http://mail.python.org/mailman/listinfo/python-list
 

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