Re: Embedding python : can't find encoding error

2011-03-01 Thread swapnil
On Feb 28, 4:57 pm, Mathieu CLERICI  wrote:
> Hi,
>
> I'm trying to embed python in a c++ program.
> I have compiled python32.lib with msvc 2010 targetting 32bits, i link
> it with my program wich is also 32bit.
> I get an error when calling Py_Initialize() : "no codec search
> functions registered:  can't find encoding"
>
> Py_FileSystemDefaultEncoding value is "mbcs".
>
> _PyCodec_Lookup raise an eror because  len = PyList_Size(interp-
>
> >codec_search_path); returns 0 in codecs.c
>
> Does someone already had this problem ? I have no idea how to solve
> that.
>
> Sorry for my bad english.

While initializing python import site.py module and I think
subsequently several other modules. Probably its in this process that
Python is trying to register the codes from the encoding package of
standard library. You must provide the path to the standard library to
the exe that you generate. You can do this by setting the environment
variables PYTHONPATH, PYTHONHOME (Refer
http://docs.python.org/using/cmdline.html#environment-variables ) in
your program before calling Py_Initialize()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Framework / CMS for Banking

2015-06-02 Thread Swapnil

Respected: Thanks. Would you mind if , i ask you more detail Q’s on the 
framework. If not then any resources where i can i ask more Q’s ?

Best
Dr. Swapnil Bhadade
M.B.B.S
M.S
Yindu (India)
[email protected].
………..
Please acknowledge receipt of this email.


The information in this e-mail is confidential and may be legally privileged. 
It is intended solely for the addressee. Access to this e-mail by anyone else 
is unauthorized. If you have received this communication in error, please 
address with the subject heading "Received in error," send to the original 
sender , then delete the e-mail and destroy any copies of it. If you are not 
the intended recipient, any disclosure, copying, distribution or any action 
taken or omitted to be taken in reliance on it, is prohibited and may be 
unlawful.



Please consider the environment before printing this email.
……...




> On 02-Jun-2015, at 19:35, Laura Creighton  wrote:
> 
> In a message of Tue, 02 Jun 2015 05:41:31 -0700, Swapnil Bhadade writes:
>> I am want to know which are the best CMS / framework for building web 
>> banking / Financial / lending services 
>> Best
>> -- 
>> https://mail.python.org/mailman/listinfo/python-list
> 
> See this video.
> https://ep2013.europython.eu/conference/talks/python-in-banks
> 
> Laura

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


Retrieving exception value in C

2009-12-22 Thread swapnil
I am trying to retrieve the value of the exception (the message part)
raised in python, in C.

Running the below script,

import shutil
fd= open("testfile","w")
fd.write("some junk")
fd.close()
shutil.copy("testfile","testfile")

will generate an exception like this,

Traceback (most recent call last):
  File "C:\Python26\lib\myscript.py", line 10, in 
shutil.copy("testfile","testfile")
  File "C:\Python26\lib\shutil.py", line 88, in copy
copyfile(src, dst)
  File "C:\Python26\lib\shutil.py", line 47, in copyfile
raise Error, "`%s` and `%s` are the same file" % (src, dst)
shutil.Error: `testfile` and `testfile` are the same file


But if I run (actually import) the script from within a C code
(embedding python in C), I am able to get the exception object but not
the value.
The code looks like,

int main()
{
PyObject *exc, *val, *tbk, *module, *name;
PyObject *exc_str;
Py_Initialize();
name = PyString_FromString("myscript");
module = PyImport_Import(name);
Py_DECREF(name);
if(!module)
{
printf("error in running script\n");
if( PyErr_Occurred())
{
if(PyErr_ExceptionMatches(PyExc_Exception))
{
printf("exception received in C\n");
}
PyErr_Fetch(&exc, &val, &tbk);
exc_str = PyObject_Str(exc);
printf("exception received: %s\n", PyString_AsString(exc_str));
printf("exception value: %s\n",PyString_AsString(val));
Py_DECREF(exc_str);
Py_DECREF(exc);
Py_DECREF(val);
Py_DECREF(tbk);
}
else{
printf("no exception received in C\n");
}

}
Py_XDECREF(module);
PyErr_Clear();
Py_Finalize();
return 0;
}

I get output,

error in running script
exception received in C
exception received: 
exception value: (null)

While the last line should be,

exception value: `testfile` and `testfile` are the same file

Although I think its not required, FYI I'm running python 2.6.2 on
WinXP


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


usage of .pth files

2010-01-13 Thread swapnil
Python's documentation (http://docs.python.org/install/
index.html#modifying-python-s-search-path) states that we can add more
locations to python's module search path by
"add a path configuration file to a directory that’s already on
Python’s path, usually to the .../site-packages/ directory"

sys.path for my Python installation show the following
>>> sys.path
['', 'C:\\WINNT\\system32\\python26.zip', 'c:\\python26\\DLLs', 'c:\
\python26\\lib', 'c:\\python26\\lib\\plat-win', 'c:\\python26\\lib\
\lib-tk', 'c:\\python26', 'c:\\python26\\lib\\site-packages']

I tried appending certain location by putting a .pth file in all of
the above locations, but it gets appended only when the .pth file is
present in 'c:\\python26\\lib\\site-packages' or 'c:\\python26', but
according to the documentation it should work for all of the above
locations. Any ideas??

I'm running Python 2.6.4 on WinXP
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can I catch segmentation fault in python?

2010-11-16 Thread swapnil
On Nov 17, 10:26 am, justin  wrote:
> Hi all,
>
> I am calling a program written in C inside Python using ctypes,
> and it seems that sometimes the program in C crashes while it's being
> used in Python.
> Even under the circumstances, I want to get the Python program going
> by handling the segmentation fault.
>
> I've already searched the Internet, but couldn't get the right answer
> to catch them.
> Could any of you please let me know how to deal with this and catch
> the segmentation fault in Python?
>
> Thanks,
> Justin.

Segmentation fault isn't exactly an exception that you can catch. It
usually means something has gone horribly wrong, like dereferencing
invalid pointer, trying to access memory out of process's range. Since
if you run out of memory Python simply raises MemoryError exception,
which you can catch. So that is not the case for segmentation fault.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Unladen Swallow dead?

2010-11-16 Thread swapnil
On Nov 17, 3:30 am, laspi  wrote:
> There has been little or no activity at all in this project in the
> last months, and the last comments on their mailing list seem to
> conrfim that it's future is uncertain.
> It's also very strange the lack of updates, news or discussions,
> specially considering that the merging plan has been approved. Or it
> hasn't?

AFAIK, the merging plan was approved by Guido early this year. I guess
Google is expecting the community to drive the project from here on.
That was the whole idea for merging it to mainline. From my last
conversation with Collin, they are targeting Python 3.3
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: import site fails - Please Help

2010-11-17 Thread swapnil
On Nov 15, 1:46 pm, Helmut Jarausch 
wrote:
> Hi, I'm completely puzzled and I hope someone
> can shed some light on it.
>
> After cloning a running system, booting the new machine from a rescue CD,
> chroot to the new root partition, I get the following strange error
> from python upon startup
>
> python -v> import site failed
>
> 
> st= os.stat(path)
> stat() argument 1 must be encoded string without NULL bytes, not str
>
> So, what's broken? How can I get out what 'path' contained at this
> moment?
>
> Many thanks for your help,
> Helmut.

Perhaps its not able to locate the libraries. Try using
http://docs.python.org/using/cmdline.html#envvar-PYTHONPATH and
http://docs.python.org/using/cmdline.html#envvar-PYTHONHOME
-- 
http://mail.python.org/mailman/listinfo/python-list


In-process interpreters

2010-11-17 Thread swapnil
Hi,

Please refer my post on Python-ideas list

http://mail.python.org/pipermail/python-ideas/2010-November/008666.html

and provide feedback if any.
-- 
http://mail.python.org/mailman/listinfo/python-list


python path separator

2010-09-02 Thread swapnil
I could not find any documentation for variables os.path.sep and
os.path.altsep. Although the first is pretty straightforward can
anyone explain the purpose of the second variable? Is it even useful?
According to issue http://bugs.python.org/issue709428, os.path.altsep
was 'None' till a long time and it didn't bother anyone?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python path separator

2010-09-02 Thread swapnil
On Sep 2, 12:25 pm, Vlastimil Brom  wrote:
> 2010/9/2 swapnil :> I could not find any documentation 
> for variables os.path.sep and
> > os.path.altsep. Although the first is pretty straightforward can
> > anyone explain the purpose of the second variable? Is it even useful?
> > According to issuehttp://bugs.python.org/issue709428, os.path.altsep
> > was 'None' till a long time and it didn't bother anyone?
> > --
> >http://mail.python.org/mailman/listinfo/python-list
>
> seehttp://docs.python.org/library/os.html#os.sephttp://docs.python.org/library/os.html#os.altsep
>
> On windows it returns a slash>>> os.altsep
>
> '/'
> which is often easier to use (i.e. if I understand correctly, in most
> usual cases the forward slash should probably just work on most of the
> recent OSes).
>
>    vbr

Thanks for help
-- 
http://mail.python.org/mailman/listinfo/python-list


Python default search paths

2010-10-19 Thread swapnil
Python allows adding user defined paths to the module search path by
setting PYTHONPATH environment variable. It also allows to alter the
location of standard python libraries using PYTHONHOME. But there is
no way to "only" have user defined paths to python's search paths
(sys.path)

This is useful for embedding applications where it might be desired
that only user-defined paths are searched for modules. But python
creates some default paths and adds it to sys.path.  Most of the times
it does not matter since PYTHONPATH paths are appended at the
beginning but this may sometimes result in unwanted behavior.

I think it would be a good idea to be able to say that you don't need
any default search paths. In this case if Python gives error if
PYTHONPATH is not set-  I think that would be reasonable. Since
otherwise sys.path would be empty!!

Please provide feedback for this feature request.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python debug assertion

2010-10-20 Thread swapnil
Python disables MSCRT assertions for debug mode in the initialization
of exceptions module. Does anyone know why?
-- 
http://mail.python.org/mailman/listinfo/python-list


progress bar

2015-02-24 Thread Swapnil Pande
i want to call another tkinter window after completing the progress bar
an n e one help me
-- 
https://mail.python.org/mailman/listinfo/python-list


Framework / CMS for Banking

2015-06-02 Thread Swapnil Bhadade
 I am want to know which are the best CMS / framework for building web banking 
/ Financial / lending services 
Best
-- 
https://mail.python.org/mailman/listinfo/python-list