[issue44709] [3.7] Popen Control Characters in stdout affect shell session

2021-07-23 Thread San


San  added the comment:

I just realised that this is not a problem of python but rather a problem of 
the shell that I was using. I was testing the io in a different environment. 
Now I retried in the same environment that the wrapper was operating and the 
behaviour is the same using io.

Sorry for the confusion and thanks for nudging me the right direction.

--

___
Python tracker 
<https://bugs.python.org/issue44709>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44709] [3.7] Popen Control Characters in stdout affect shell session

2021-07-23 Thread San


San  added the comment:

I get your point. But I thought setting 'stdout=PIPE' should not send the 
stdout directly to the terminal but rather through the pipe first?!

Also what you're saying seems to contradict that this doesn't happen if I don't 
set the encoding and let it be a byte-stream. In that case you get the full 
byte-stream without any control-characters being executed.

In my opinion it is unintuitive that this is happening. 

For instance if I open a file using io, that contains the same control 
characters like so:
f = open('cc.txt', 'r', encoding='latin_1')

Then gladly this doesn't happen and the control chars get escaped using \x1b 
which is what I would also expect to happen when using Popen.

--

___
Python tracker 
<https://bugs.python.org/issue44709>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44709] [3.7] Popen Control Characters in stdout affect shell session

2021-07-22 Thread San


New submission from San :

I was trying to wrap an old game server executable with a built-in console 
using Popen.

class ServerWrapper(Thread):
def __init__(self, pathToExecutable: str, statusMonitor: Popen = None, 
active: bool = False):
super().__init__()
self.pathToExecutable = pathToExecutable
self.statusMonitor = statusMonitor
self.active = active

def run(self):
self.statusMonitor = Popen(['./bf1942_lnxded', "+statusMonitor", '1'], 
encoding='latin_1', stdout=PIPE,
   stdin=PIPE, cwd=self.pathToExecutable)
while self.active:
currentLine = self.statusMonitor.stdout.readline()
if currentLine:
print(currentLine)
input('')

def start(self):
self.active = True
super().start()

def stop(self):
self.active = False



I expected to be able to read the output line-by-line using enter, in a 'normal 
fashion'.
After importing this from a terminal and setting it up somewhat like so:

wrapper = ServerWrapper('bf1942')
wrapper.start()

However, once the server process started and thereby started writing to stdout, 
weird stuff started to happen to my shell with the python interpreter.

Apparently, there are control characters and ansi-escape codes sent from the 
process, that somehow manage to manipulate my shell if I specify an encoding. 
Consequentially the lines output with 'print(currentLine)' are reduced by these 
chars.

Is this the desired behaviour of the decoder? If so then I think this should 
potentially be further clarified in the documentation of Popen. I would have 
expected the chars to be escaped because the worst thing is, this happens even 
if you don't actually read from stdout at all. Seemingly the decoder executes 
incoming control sequences immediately (probably for the buffer?), regardless 
of if you actually bother to read the stdout or not.

The paragraph in 
https://docs.python.org/3.7/library/subprocess.html#security-considerations 
sounds like this shouldn't be happening if 'shell' is not set to 'True' at 
least.

--
files: shell.png
messages: 397986
nosy: San
priority: normal
severity: normal
status: open
title: [3.7] Popen Control Characters in stdout affect shell session
versions: Python 3.7
Added file: https://bugs.python.org/file50170/shell.png

___
Python tracker 
<https://bugs.python.org/issue44709>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Python for Windows

2020-10-14 Thread Ana María Pliego San Martín
Hi!

I've tried to install Python a couple of times on my computer. Although it
works fine when first downloaded, every time I turn off my computer and
then back on Python says it has a problem that needs fixing. After "fixing"
it, I still encounter some issues and have the need to uninstall it and
install it again. Do you know what the problem is?

Thank you.

Ana

-- 
*POLÍTICA DE 
PRIVACIDAD: Las instituciones pertenecientes al Sistema 
UP-IPADE 
utilizarán cualquier dato personal expuesto en el presente correo 

electrónico, única y exclusivamente para cuestiones académicas, 
administrativas, de comunicación, o bien para las finalidades expresadas
 
en cada asunto en concreto, esto en cumplimiento con la Ley Federal de 
Protección de Datos Personales en Posesión de los Particulares. Para 
mayor 
información acerca del tratamiento y de los derechos que puede 
hacer 
valer, usted puede acceder al aviso de privacidad integral a 
través de 
nuestras páginas de Internet: www.up.edu.mx  / 
prepaup.up.edu.mx  / www.ipade.mx 
 / www.ipadealumni.com.mx 
 
La información contenida en este correo es 
privada y confidencial, dirigida exclusivamente a su destinatario. Si usted 
no es el destinatario del mismo debe destruirlo y notificar al remitente 
absteniéndose de obtener copias, ni difundirlo por ningún sistema, ya que 
está prohibido y goza de la protección legal de las comunicaciones.*

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


[issue40034] cgi.parse() does not work with multipart POST requests.

2020-03-23 Thread San


Change by San :


--
keywords: +patch
pull_requests: +18492
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19130

___
Python tracker 
<https://bugs.python.org/issue40034>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40034] cgi.parse() does not work with multipart POST requests.

2020-03-21 Thread San


New submission from San :

The cgi.parse stdlib function works in most cases but never works when given a 
multipart/form-data POST request because it does not set up pdict in a way 
cgi.parse_multipart() likes (boundary as bytes (not str) and including content 
length).




$ pwd
/tmp
$
$ /tmp/cpython/python --version
Python 3.9.0a4+
$
$ cat cgi-bin/example.cgi
#!/tmp/cpython/python
import sys, cgi
query_dict = cgi.parse()
write = sys.stdout.buffer.write
write("Content-Type: text/plain; charset=utf-8\r\n\r\n".encode("ascii"))
write(f"Worked, query dict is {query_dict}.\n".encode())
$
$ /tmp/cpython/python -m http.server --cgi & sleep 1
[1] 30201
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
$
$ # GET (url-encoded) requests work:
$ curl localhost:8000/cgi-bin/example.cgi?example_key=example_value
127.0.0.1 - - [20/Mar/2020 23:33:48] "GET 
/cgi-bin/example.cgi?example_key=example_value HTTP/1.1" 200 -
Worked, query dict is {'example_key': ['example_value']}.
$
$ # POST (multipart) requests do not:
$ curl localhost:8000/cgi-bin/example.cgi -F example_key=example_value
127.0.0.1 - - [20/Mar/2020 23:34:15] "POST /cgi-bin/example.cgi HTTP/1.1" 200 -
Traceback (most recent call last):
  File "/tmp/cgi-bin/example.cgi", line 3, in 
query_dict = cgi.parse()
  File "/tmp/cpython/Lib/cgi.py", line 159, in parse
return parse_multipart(fp, pdict)
  File "/tmp/cpython/Lib/cgi.py", line 201, in parse_multipart
boundary = pdict['boundary'].decode('ascii')
AttributeError: 'str' object has no attribute 'decode'
127.0.0.1 - - [20/Mar/2020 23:34:16] CGI script exit status 0x100
$
$ $EDITOR /tmp/cpython/Lib/cgi.py
$
$ # After changing cgi.parse POST (multipart) requests work:
$ curl localhost:8000/cgi-bin/example.cgi -F example_key=example_value
127.0.0.1 - - [20/Mar/2020 23:35:10] "POST /cgi-bin/example.cgi HTTP/1.1" 200 -
Worked, query dict is {'example_key': ['example_value']}.
$

--
components: Library (Lib)
messages: 364762
nosy: sangh
priority: normal
severity: normal
status: open
title: cgi.parse() does not work with multipart POST requests.
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue40034>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Re: ValueError: I/O operation on closed file

2016-05-25 Thread San
On Wednesday, May 25, 2016 at 6:00:07 PM UTC+5:30, San wrote:
> Hi Gorup,
> 
> why i am getting "ValueError: I/O operation on closed file" this error.
> Pls let me know.
> 
> Thanks in Advance.
> san

Hello,
Following is the code i used.

def test_results(filename):
import csv
with open(filename,"rU") as f:
 reader = csv.reader(f,delimiter="\t")
 result = {}
for row in reader:
key = row[0]
if key in result:
result[row[0]].append(row[1])
else:
result[row[0]] = key
result[key]=row[1:]
print result

filename ='filename.csv'
test_results(filename)
-- 
https://mail.python.org/mailman/listinfo/python-list


ValueError: I/O operation on closed file

2016-05-25 Thread San
Hi Gorup,

why i am getting "ValueError: I/O operation on closed file" this error.
Pls let me know.

Thanks in Advance.
san
-- 
https://mail.python.org/mailman/listinfo/python-list


def __init__(self,cls):

2016-04-29 Thread San
Dear Group,

Please explain the following in details.

"
def __init__(self,cls):
self.cls = cls
"

Thanks in Advance.
San
-- 
https://mail.python.org/mailman/listinfo/python-list


def __init__(self):

2016-04-26 Thread San
Hi All,

Pls let me why 
"
def __init__(self):

"
declaration required, what's the use of this one.Pls explain  me in details.

Thanks in advance.
-- 
https://mail.python.org/mailman/listinfo/python-list


from __future__ import print_function

2016-04-24 Thread San
Hi All,
I want details explanation(why this statement used,when it can be used,etc) of 
following statement in python code

"from __future__ import print_function"

Thanks in advance.
-- 
https://mail.python.org/mailman/listinfo/python-list


Graph or Chart Software for Django

2014-01-17 Thread San D
What is the best Graph or Chart software used with Django (libraries  
products), preferably open source?

Need something stable and robust, and used by many developers, so active on 
community channels.

Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Templating engines that work very well with Python/Django

2014-01-17 Thread San D
Can someone suggest a few templating engines that work really well with Django 
and help in coding efficiency?

Where can I fin comparison of tempating engines I can find to know their pros 
and cons?

Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


How to read a make file in python and access its elements

2013-07-22 Thread san
How to read/load  the cmake file in python and access its elements.  
I have a scenario, where i need to load the make file and access its elements.  
I have tried reading the make file as text file and parsing it,but its not the 
ideal solution 
Please let me know how to load the .mk file and access its elements in python.
-- 
http://mail.python.org/mailman/listinfo/python-list


Weird python behavior

2013-04-24 Thread Forafo San
Hello All,
I'm running Python version 2.7.3_6 on a FreeBSD system. The following session 
in a Python interpreter throws a mysterious TypeError:

--
[ppvora@snowfall ~/xbrl]$ python 
Python 2.7.3 (default, Apr 22 2013, 18:42:18) 
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd8
Type help, copyright, credits or license for more information.
 import glob
Traceback (most recent call last):
  File stdin, line 1, in module
  File glob.py, line 14, in module
myl = glob.glob('data/*.xml')
TypeError: 'module' object is not callable
--
The file glob.py that the error refers to was run under another screen session. 
It's a mystery why even that program threw an error. Regardless, why should 
that session throw an import error in this session? Weird. Any help is 
appreciated. Thanks,
-Premal 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Weird python behavior

2013-04-24 Thread Forafo San
On Wednesday, April 24, 2013 3:08:27 PM UTC-4, Neil Cerutti wrote:
 On 2013-04-24, Forafo San ppv.g...@gmail.com wrote:
 
  Hello All,
 
  I'm running Python version 2.7.3_6 on a FreeBSD system. The following 
  session in a Python interpreter throws a mysterious TypeError:
 
 
 
  --
 
  [ppvora@snowfall ~/xbrl]$ python 
 
  Python 2.7.3 (default, Apr 22 2013, 18:42:18) 
 
  [GCC 4.2.1 20070719  [FreeBSD]] on freebsd8
 
  Type help, copyright, credits or license for more information.
 
  import glob
 
  Traceback (most recent call last):
 
File stdin, line 1, in module
 
File glob.py, line 14, in module
 
  myl = glob.glob('data/*.xml')
 
  TypeError: 'module' object is not callable
 
  --
 
  The file glob.py that the error refers to was run under another
 
  screen session. It's a mystery why even that program threw an
 
  error. Regardless, why should that session throw an import
 
  error in this session? Weird. Any help is appreciated. Thanks,
 
 
 
 'Cause Python's import statement looks in the current directory
 
 first for files to import. So you're importing your own
 
 error-riddled and mortal glob.py, rather than Python's pristine
 
 and Olympian glob.py.
 
 
 
 -- 
 
 Neil Cerutti
 
   This room is an illusion and is a trap devisut by Satan.  Go
 
 ahead and dauntlessly!  Make rapid progres!
 
   --Ghosts 'n Goblins

OK, lesson learned: Take care not to have module names that conflict with 
python's built ins. Sorry for being so obtuse.
-- 
http://mail.python.org/mailman/listinfo/python-list


How to sort list of String without considering Special characters and with case insensitive

2012-11-27 Thread san
Please let me know how to sort the list of String in either ascending / 
descending order without considering special characters and case.
ex: list1=['test1_two','testOne','testTwo','test_one']
Applying the list.sort /sorted method results in sorted list ['test1_two', 
'testOne', 'testTwo', 'test_one']
but the without considering the special characters and case it should be 
['testOne','test_one', 'test1_two','testTwo'] OR 
['test_one','testOne','testTwo', 'test1_two' ]

list.sort /sorted method sorts based on the ascii value of the characters but 
Please let me knwo how do i achieve my expected one
-- 
http://mail.python.org/mailman/listinfo/python-list


How Run Py.test from PyScripter

2012-11-14 Thread san
I am a newbie to py.test , Please let me know how to run the py.test in 
PyScripter Editor. I have tried in the belwo way but it doesn't work.

import pytest

def func(x): return x + 1

def test_answer(): assert func(3) == 5

pytest.main()

below is the Exception that i get 

Traceback (most recent call last):
  File module1, line 10, in module
  File C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py, 
line 474, in main
exitstatus = config.hook.pytest_cmdline_main(config=config)
  File C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py, 
line 422, in __call__
return self._docall(methods, kwargs)
  File C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py, 
line 433, in _docall
res = mc.execute()
  File C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py, 
line 351, in execute
res = method(**kwargs)
  File C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\main.py, 
line 107, in pytest_cmdline_main
return wrap_session(config, _main)
  File C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\main.py, 
line 92, in wrap_session
config.pluginmanager.notify_exception(excinfo, config.option)
  File C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py, 
line 285, in notify_exception
res = self.hook.pytest_internalerror(excrepr=excrepr)
  File C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py, 
line 422, in __call__
return self._docall(methods, kwargs)
  File C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py, 
line 433, in _docall
res = mc.execute()
  File C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\core.py, 
line 351, in execute
res = method(**kwargs)
  File 
C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\terminal.py, 
line 152, in pytest_internalerror
self.write_line(INTERNALERROR  + line)
  File 
C:\Python27\lib\site-packages\pytest-2.3.2-py2.7.egg\_pytest\terminal.py, 
line 140, in write_line
self._tw.line(line, **markup)
  File 
C:\Python27\lib\site-packages\py-1.4.11-py2.7.egg\py\_io\terminalwriter.py, 
line 181, in line
self.write(s, **kw)
  File 
C:\Python27\lib\site-packages\py-1.4.11-py2.7.egg\py\_io\terminalwriter.py, 
line 225, in write
self._file.write(msg)
  File 
C:\Python27\lib\site-packages\py-1.4.11-py2.7.egg\py\_io\terminalwriter.py, 
line 241, in write
self._writemethod(data)
TypeError: 'AsyncStream' object is not callable
-- 
http://mail.python.org/mailman/listinfo/python-list


[issue14835] plistlib: output empty elements correctly

2012-05-29 Thread Sidney San Martín

Sidney San Martín s...@sidneysm.com added the comment:

Thanks Hynek, awesome! It looks like it’s in now.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14835
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14835] plistlib: output empty elements correctly

2012-05-27 Thread Sidney San Martín

Sidney San Martín s...@sidneysm.com added the comment:

Hynek: Here you go!

Ronald: Emailed it in on Friday.

--
Added file: http://bugs.python.org/file25734/plistlib_empty_element_test.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14835
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14652] Better error messages for wsgiref validator failures

2012-05-17 Thread Sidney San Martín

Sidney San Martín s...@sidneysm.com added the comment:

Thanks Jeff, I’m actually a relatively new Python developer and got the 
impression that it was best practice to always use a tuple for string 
formatting, for consistency.

Here’s an updated patch which drops the tuples for those cases.

--
Added file: http://bugs.python.org/file25624/ssm_validate.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14652
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14835] plistlib: output empty elements correctly

2012-05-16 Thread Sidney San Martín

New submission from Sidney San Martín s...@sidneysm.com:

plistlib’s output is currently byte-for-byte identical to Apple’s, except 
arrays and dictionaries are stored with self-closing tags (e.g. 'array/') and 
plistlib outputs empty tags with a newline (e.g. 'array\n/array').

This tiny patch makes its output for empty arrays and dictionaries consistent 
with the OS’s.

--
assignee: ronaldoussoren
components: Library (Lib), Macintosh
files: plistlib_empty_objects.patch
keywords: patch
messages: 160934
nosy: ronaldoussoren, ssm
priority: normal
severity: normal
status: open
title: plistlib: output empty elements correctly
type: behavior
versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file25620/plistlib_empty_objects.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14835
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14652] Better error messages for wsgiref validator failures

2012-04-23 Thread Sidney San Martín

New submission from Sidney San Martín s...@sidneysm.com:

wsgiref’s validation middleware is missing messages for many of its assertions, 
and its docstring doesn’t reflect read() now requiring an argument (said that 
it took an optional argument).

Here’s a patch to add some and update the comment.

--
components: Library (Lib)
files: ssm_validate.patch
keywords: patch
messages: 159053
nosy: ssm
priority: normal
severity: normal
status: open
title: Better error messages for wsgiref validator failures
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file25320/ssm_validate.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14652
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14204] Support for the NPN extension to TLS/SSL

2012-03-10 Thread Sidney San Martín

Changes by Sidney San Martín s...@sidneysm.com:


--
nosy: +ssm

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14204
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



Replacement for the shelve module?

2011-08-19 Thread Forafo San
Folks,
What might be a good replacement for the shelve module, but one that
can handle a few gigs of data. I'm doing some calculations on daily
stock prices and the result is a nested list like:

[[date_1, floating result 1],
 [date_2, floating result 2],
...
 [date_n, floating result n]]

However, there are about 5,000 lists like that, one for each stock
symbol. Using the shelve module I could easily save them to a file
( myshelvefile['symbol_1') = symbol_1_list) and likewise retrieve the
data. But shelve is deprecated AND when a lot of data is written
shelve was acting weird (refusing to write, filesizes reported with an
ls did not make sense, etc.).

Thanks in advance for your suggestions.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Replacement for the shelve module?

2011-08-19 Thread Forafo San
On Aug 19, 11:54 am, Thomas Jollans t...@jollybox.de wrote:
 On 19/08/11 17:31, Forafo San wrote:









  Folks,
  What might be a good replacement for the shelve module, but one that
  can handle a few gigs of data. I'm doing some calculations on daily
  stock prices and the result is a nested list like:

  [[date_1, floating result 1],
   [date_2, floating result 2],
  ...
   [date_n, floating result n]]

  However, there are about 5,000 lists like that, one for each stock
  symbol. Using the shelve module I could easily save them to a file
  ( myshelvefile['symbol_1') = symbol_1_list) and likewise retrieve the
  data. But shelve is deprecated AND when a lot of data is written
  shelve was acting weird (refusing to write, filesizes reported with an
  ls did not make sense, etc.).

  Thanks in advance for your suggestions.

 Firstly, since when is shelve deprecated? Shouldn't there be a
 deprecation warning onhttp://docs.python.org/dev/library/shelve.html?

 If you want to keep your current approach of having an object containing
 all the data for each symbol, you will have to think about how to
 serialise the data, as well as how to store the documents/objects
 individually. For the serialisation, you can use pickle (as shelve does)
 or JSON (probably better because it's easier to edit directly, and
 therefore easier to debug).
 To store these documents, you could use a huge pickle'd Python
 dictionary (bad idea), a UNIX database (dbm module, anydbm in Python2;
 this is what shelve uses), or simple the file system: one file per
 serialised object.

 Looking at your use case, however, I think what you really should use is
 a SQL database. SQLite is part of Python and will do the job nicely.
 Just use a single table with three columns: symbol, date, value.

 Thomas

Sorry. There is no indication that shelve is deprecated. I was using
it on a FreeBSD system and it turns out that the bsddb module is
deprecated and confused it with the shelve module.

Thanks Ken and Thomas for your suggestions -- I will play around with
both and pick one.
-- 
http://mail.python.org/mailman/listinfo/python-list


TypeError: 'module' object is not callable

2011-08-11 Thread Forafo San
I wrote a class, Univariate, that resides in a directory that is in my 
PYTHONPATH. I'm able to import that class into a *.py file. However when I try 
to instantiate an object with that class like:

x = Univariate(a) # a is a list that is expected by the Univariate 
class

python raises the TypeError: 'module' object is not callable.  If I embed the 
code of the Univariate class in my *.py file, there is no problem.  Also, when 
the class is imported and I do a

print dir(Univariate)

it does not print all the methods that are in the class, while if the class 
code appears in my *.py file, all the methods are available and a list with the 
correct methods are printed.

What gives?

Thanks in advance.
==
FreeBSD 7.2 machine with python version 2.5.6
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: TypeError: 'module' object is not callable

2011-08-11 Thread Forafo San
On Thursday, August 11, 2011 8:22:20 PM UTC-4, MRAB wrote:
 On 11/08/2011 23:43, Forafo San wrote:
  I wrote a class, Univariate, that resides in a directory that is in my 
  PYTHONPATH. I'm able to import that class into a *.py file. However when I 
  try to instantiate an object with that class like:
 
  x = Univariate(a) # a is a list that is expected by the 
  Univariate class
 
  python raises the TypeError: 'module' object is not callable.  If I embed 
  the code of the Univariate class in my *.py file, there is no problem.  
  Also, when the class is imported and I do a
 
  print dir(Univariate)
 
  it does not print all the methods that are in the class, while if the class 
  code appears in my *.py file, all the methods are available and a list with 
  the correct methods are printed.
 
  What gives?
 
 I think you mat be confusing the class with the module.
 
 When you write:
 
  import Univariate
 
 you're importing the module.
 
 If the module is called Univariate and the class within the module is
 called Univariate then you should either write:
 
  import Univariate
  x = Univariate.Univariate(a) # the class Univariate in the module 
 Univariate
 
 or:
 
  from Univariate import Univariate
  x = Univariate(a)
 
 Incidentally, it's recommended that module names use lowercase, so that
 would be:
 
  import univariate
  x = univariate.Univariate(a)
 
 or:
 
  from univariate import Univariate

Thank you all for your replies. When I do a

from Univariate import Univariate

the TypeError disappears and everything is fine.  Clearly this was an error 
that a newbie such as myself is likely to make because of little experience 
with Python. However, this isn't something I'm likely to forget.

I will also adopt the style recommendations.  Thanks, again.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can I use python for this .. ??

2006-05-05 Thread san
Rick

Thanks for your reply .. didnt quite get your point in loggin into
password protected site.
Will try to seach this group for more ..

Still looking for tab browsing and logging in password protected site
..

can i use ctype or something like that .. some modute that will
introduce key strokes .. so that i can do username tab password
enter so that i can log in .. ??

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


Can I use python for this .. ??

2006-05-04 Thread san
Hi

I am using windows xp and have installed python and win32. I am
familiar with basic Python. I wanted to control some of the
applications via python script.

I would like to write a python script to say:
1. Open firefox and log on to gmail
2. Another firefox window to visit slickdeals
3. Open winamp and tune in to a shoutcast station
4. Open groupwise ...
etc ..

These are the task I do every day whenever I log on my computer .. it
just seems repetitive and hence probably can be coded in python.

Can I do this in python? Where do I find the COM objects/interfaces for
all these different programs? Are there any sample codes ?

Thanks.
Santosh.

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


Re: Can I use python for this .. ??

2006-05-04 Thread san
btw i got the firefox to open and access some webpage and winamp
running ..

code below
--
import os
import os.path
import subprocess

# Web pages
ffox_exe = r'C:\Program Files\Mozilla Firefox\firefox.exe'
assert os.path.exists(ffox_exe)
# open gmail
url = http://www.gmail.com;
child = subprocess.Popen( (ffox_exe, url), executable = ffox_exe)
rc = child.wait()

# Winamp
wamp_exe = r'C:\Program Files\Winamp\winamp.exe'
assert os.path.exists(wamp_exe)
url = http://64.236.34.97:80/stream/1040;
child = subprocess.Popen( (wamp_exe, url), executable = wamp_exe)



now is there anyway i can enter user name and password and then click
okay .. (not for gmail but for other similar webpages which require
loggin) .. ??

how to open pages in tabs .. ?? 

San

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


Re: Can I use python for this .. ??

2006-05-04 Thread san
Petr I dont want hibernation .. its more like starting a list of
programs when i want to have fun time on my pc...

but thanx for ur reply ..

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


Re: [newbie]How to install python under DOS and is there any Wxpython can be installed under dos?

2005-02-17 Thread john san

oh, ya.

Fuzzyman [EMAIL PROTECTED] 
news:[EMAIL PROTECTED]

 john san wrote:
  Actually the windows running very good under the xbox-NTOS via
  xboxmediacenter. its just limited functions(not easy to programming
 the
  windows prog.), if we can find WxPython-like can be ported (I can
 import *
  from it  to my xboxPython) )it will be a great great . You
 will have
  HD screen and web surfing on HDTV and computing on HDTV. think about
 it!
  That is a real thing the python-like lang. should to do otherwise
 just a
  garbage(toy).
 
 
 

 I assume you mean that without python the Xbox is just a toy..

 Regards,

 Fuzzy
 http://www.voidspace.org.uk/python/index.shtml



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


Re: [newbie]How to install python under DOS and is there any Wxpython can be installed under dos?

2005-02-17 Thread john san
yes. u need mod-xbox. since its be easy done and we already have OS,
Python support what we need now is only that Python can easy to coding
and show window program just like wt we can do under Windows.


Lucas Raab [EMAIL PROTECTED] 
news:[EMAIL PROTECTED]
 Leif B. Kristensen wrote:
  john san skrev:
 
 
 Actually the windows running very good under the xbox-NTOS via
 xboxmediacenter. its just limited functions(not easy to programming
 the windows prog.), if we can find WxPython-like can be ported (I
 can import *
 from it  to my xboxPython) )it will be a great great . You
 will have HD screen and web surfing on HDTV and computing on HDTV.
 think about it! That is a real thing the python-like lang. should to
 do otherwise just a garbage(toy).
 
 
  You can run Linux with MythTV on an XBox. Does all the things you want,
  and of course it will run WxPython.

 But does that involve modding the Xbox?? As in messing with the hardware??


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


Re: [newbie]How to install python under DOS and is there any Wxpython can be installed under dos?

2005-02-16 Thread john san
pure DOS, old pc, used for teaching . want show some windows under DOS
(under Python).



Daniel Bowett [EMAIL PROTECTED] 
news:[EMAIL PROTECTED]
 john san wrote:
  How to install python under DOS and is there any Wxpython-like can be
  installed under dos?
 
  Thanks.
 
 

 Are you actually still running a pure DOS machine? Or are you running
 the dos prompt through Windows?



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


Re: [newbie]How to install python under DOS and is there any Wxpython can be installed under dos?

2005-02-16 Thread john san

Just want to show windows under dos without MsWindows. Also find some
difficulty to simply install WxPython under directory(DOS) and then run,
which is very good thing if it is just like Java.
I want a simple solution for Python to install to DOS and then can have
Windows running.( to be used under mod-xbox which support only limited
python via using xboxmediacenter. (xbox using stripped NT OS).






Harlin [EMAIL PROTECTED] 
news:[EMAIL PROTECTED]
 Any reason you're asking about wxPython for DOS? Just curious.



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


Re: [newbie]How to install python under DOS and is there any Wxpython can be installed under dos?

2005-02-16 Thread john san

Actually the windows running very good under the xbox-NTOS via
xboxmediacenter. its just limited functions(not easy to programming the
windows prog.), if we can find WxPython-like can be ported (I can import *
from it  to my xboxPython) )it will be a great great . You will have
HD screen and web surfing on HDTV and computing on HDTV. think about it!
That is a real thing the python-like lang. should to do otherwise just a
garbage(toy).




Jeff Shannon [EMAIL PROTECTED] 
news:[EMAIL PROTECTED]
 john san wrote:

  Just want to show windows under dos without MsWindows. Also find some
  difficulty to simply install WxPython under directory(DOS) and then run,
  which is very good thing if it is just like Java.

 I don't think you'll have any luck finding wxPython for DOS.  A bit of
 a looksee around the wxWidgets website (wxPython is a wrapper for
 wxWidgets) mentions being available for Win3.1 and up, as well as
 various levels of *nix installs (wxGTK, wxMotif, wxX11), but no
 mention of DOS.  I suppose that a very ambitious person could perhaps
 get the wxUniversal port to run on DOS, but I presume that this would
 be far from trivial.

 On the other hand, you probably could find and/or create some sort of
 basic text-only windowing library.  It won't be wxPython, nor anything
 even close to that level of sophistication, but that's what happens
 when you insist on using an OS that's been obsolete for a decade or
 more. ;)

 Jeff Shannon
 Technician/Programmer
 Credit International



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


[newbie]How to install python under DOS and is there any Wxpython can be installed under dos?

2005-02-15 Thread john san
How to install python under DOS and is there any Wxpython-like can be
installed under dos?

Thanks.


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


pyclbr

2005-02-10 Thread Fernando San Martín Woerner
Hi guys!

i'm using pycblr to implement a class browser for my app, i got some
issues about it:

i did:

dict = pyclbr.readmodule(name, [dir] + sys.path)

but  this only works one time, i mean if module name is changed and
some class were added or removed i can't see any changes even if i
execute readmodule again.

any idea?, thanks in advance


-- 
Fernando San Martn Woerner
Jefe de Informtica
Galilea S.A.

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