Hello,
I need to import modules from user defined paths. I.e. I want to do
something
like:
module_dir = sys.argv[1]
my_path = os.path.join(module_dir, 'bin', 'my_module')
from my_path import my_object
Obviously, it doesn't work this way. How would it work?
Jörg Schuster
--
http://mail.pytho
Thanks a lot to all.
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
Python regular expressions must not have more than 100 capturing
groups. The source code responsible for this reads as follows:
# XXX: get rid of this limitation!
if p.pattern.groups > 100:
raise AssertionError(
"sorry, but this version only supports 100 named
> Some people, when confronted with a problem, think "I know,
> I'll use regular expressions." Now they have two problems.
> --Jamie Zawinski
Thanks for the citation.
If my goal had been to redesign my program, I would not ask questions
about regular expressions. I do not have the time to redesig
> What happens if you up the limit to whatever you need?
Good idea. I just tried this. Nothing evil seems to happen. This seems
to be a solution. Thanks.
Jörg
--
http://mail.python.org/mailman/listinfo/python-list
No limitation at all would be best. If a limitation is necessary, then
the more capturing groups, the better. At the time being, I would be
really happy about having the possibility to use 1 capturing
groups.
Jörg
--
http://mail.python.org/mailman/listinfo/python-list
> but what is the reason for so much capturing groups? I
> imagine that coding this and keeping code maintenable is a huge effort.
User input is compiled to regular expressions. The user does not have
to worry about those groups.
--
http://mail.python.org/mailman/listinfo/python-list
> The joys of open source. Just remember you have now
> made your program
> non-portable. Hope this isn't an issue.
Of course portability is an issue -- on the long run. But on the short
run I am really glad to be able to do a 1 second demo run on my
notebook instead of a 20 seconds demo run. And
You did not quite understand me. I will give you some details:
My program is a compiler for a certain type of linguistic grammars.
I.e. the user gives *grammar files* to my program. When the grammar
files have been compiled, they can be applied to strings (of a certain
language, e.g. English).
In
> if you want to know why 100 is a reasonable and non-random choice, I
> suggest checking the RE documentation for "99 groups" and the special
> meaning of group 0.
I have read everything I found about Python regular expressions. But I
am not able to understand what you mean. What is so special ab
So what?
--
http://mail.python.org/mailman/listinfo/python-list
My first test program was far too naive. Evil things do happen. Simply
removing the code that restricts the number of capturing groups to 100
is not a solitution.
--
http://mail.python.org/mailman/listinfo/python-list
... solution
--
http://mail.python.org/mailman/listinfo/python-list
> It's a conflict between python's syntax for regex back
> references and
> octal number literals. Probably wasn't noticed until way
> too late, and
> now it will never change.
So "reasonable choice" is not a really good description of the
phenomenon.
--
http://mail.python.org/mailman/listinfo/
Hello,
code like
os.system(command)
only works for some values of 'command' on my system (Linux). A certain
shell command (that *does* run on the command line) does not work when
called with os.system(). Does anyone know a simple and stable way to
have *any* string executed by the shell?
Jörg S
Well, I can give you the string, but that will not help:
transduce abc info_dic comp_dic input_file output_file
For copy right reasons, I am not allowed to give you the program
transduce.
But here are some facts about transduce:
- it is written in C
- it takes an alphabet file (abc) and two aut
> Several variables like PATH "normally" get reset even when
> running a non-login subshell
It seems that this has been the problem. I guess your tip saved me a
lot of time. Thanks a lot.
Joerg
--
http://mail.python.org/mailman/listinfo/python-list
> Several variables like PATH "normally" get reset even when
> running a non-login subshell
It seems that this has been the problem. I guess your tip saved me a
lot of time. Thanks a lot.
Joerg
--
http://mail.python.org/mailman/listinfo/python-list
I may use has 80G RAM.
So, using a dictionary will not help.
Any ideas?
Joerg Schuster
--
http://mail.python.org/mailman/listinfo/python-list
Thanks to all. This thread shows again that Python's best feature is
comp.lang.python.
Jörg
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
is there a way to compile a python file foo.py to foo.pyc (or foo.pyo)
such that foo.pyc can be run with 'foo.pyc' (as opposed to 'python
foo.pyc') on the command line?
Jörg Schuster
--
http://mail.python.org/mailman/listinfo/python-list
> #!/usr/bin/env python
> import app
Yes, of course this is a possibility. But it implies having (or giving
away) two files.
I think having one file is always better than having two files. Because
if you have two files, you need a third one: a README that tells you
what to do with the two files a
> so you're saying that the set of people that can deal with
> no more than one
> file at a time but knows how to install and configure Python
> (which in itself
> comes with a few thousand files) is larger than zero?
Take me as an example: Very often, I needed software that could solve a
specific
Hello,
I want to open the file 'configuration.smo' that is in directory dir.
Yet, I don't know on which os my program is being run. On Unix I would
say:
f = open(dir + '/configuration.smo', 'r')
What is the os-independent version of this line?
(I have read the manual of the module os, but I di
Thanks, Andrew and Gerald.
Jörg
--
http://mail.python.org/mailman/listinfo/python-list
25 matches
Mail list logo