Tkinter module not found

2006-08-08 Thread Shuaib
Hey,

Even though I freshly installed Tcl and Tk, python still seem to have
problems accessing Tkinter module. Here is what says when I do "import
Tkinter"

==
Traceback (most recent call last):
  File "", line 1, in ?
ImportError: No module named Tkinter
==

Any ideas how to fix this problem? (Gentoo distribution)

Thanks.

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


Re: Tkinter module not found

2006-08-08 Thread Shuaib
Hey again,

I am using the latest python available on my system (2.4). So I don't
think that's the problem.

Any more ideas? Do I need to install Tkinter as a seperate
module/package? As I said, I've already installed Tcl/Tk, though.

Thanks for your time.


Tim Chase wrote:
> > The cause of this is usually that you are using a different
> > version of Python than the one you installed Tkinter into, but
> > being a Linux newbie I have yet to discover how to redirect
> > the 'python' command to invoke the newer version of Python.
>
>
> The OS looks for the first 'python' it finds in its path.
>
> In Linux (or other *nix OSes), you can use
>
>   bash> which python
>
> and it will reply with which python it's pointing to.  You can
> then change into that directory (usually "/usr/bin") and get back
> a listing of various pythons.  On my Debian linux distro at home,
> I get something back that looks like
>
> bash> which python
> /usr/bin/python
> bash> cd /usr/bin
> bash> ls -lsF python* | grep -o "python.*"
> python -> python2.3*
> python2.3*
> python2.4*
>
> You *should* be able to just relink the "python" link to the new
> version of python:
>
>   bash> ln -sf /usr/bin/python2.4 /usr/bin/python
>
> I don't know if this will cause other problems down the line for
> packages that expect the system default.
>
> Alternatively, at least on my system, you can force your choice
> by explicity running "python2.3" or "python2.4" instead of just
> "python".
>
> You can determine your path via
>
>   bash> echo $PATH
>
> along which your shell will search for an executable.
>
> Win32 has a similar executable search path
>
>   c:\> echo %PATH%
>
> but doesn't have something as handy as the "which" command to do
> the hunting for you.
> 
> HTH,
> 
> -tkc

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


Re: Tkinter module not found

2006-08-11 Thread Shuaib
Well, I finally solved my problem. I just had to reinstall python with
the USE flags of tcl and tk.

#USE="tcl tk" emerge python

And now I can use Tkinter

Thanks guys!

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


Calling a python script, and getting the returned result in C

2006-08-16 Thread Shuaib
Hi!

I have a python script which returns an Integer value. How do I call
this script from a C programe, and use the result returned?

Thanks for your time.

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


Re: Calling a python script, and getting the returned result in C

2006-08-16 Thread Shuaib

John Machin wrote:
> Shuaib wrote:
> > Hi!
> >
> > I have a python script which returns an Integer value. How do I call
> > this script from a C programe, and use the result returned?
>
> To avoid confusion and possible irrelevant responses, please say which
> of the following options best matches your requirement:
>
> (a) your Python script is capable of being run from the command line,
> and "returns" an integer value by calling sys.exit(that_value) -- you
> wish to execute the script from a C program [the same way you would
> execute a shell script / awk script / ...] and pick up the return value
> [which may be limited by the OS to range(0, 128)]
>
> (b) your script is a module, containing a function that returns an
> integer. You wish to create an embedded Python interpreter, import
> yourmodule, call yourmodule.yourfunc, convert the returned Python int
> to a C int, and use it.

(b) it is. :)

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


Re: Calling a python script, and getting the returned result in C

2006-08-16 Thread Shuaib

John Machin wrote:
>
> Then you need to read the Python manuals (surprise, surprise); in
> particular here's a section that gives you most if not all of what you
> want :
>
> http://docs.python.org/ext/pure-embedding.html
>
> but I'd suggest that you start reading a few pages back from there.
> 
> HTH,
> John

Thanks, that'll help.

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


How do I catch ExpatError exception?

2006-08-16 Thread Shuaib
Hey!

I am getting this exception.

xml.parsers.expat.ExpatError

But I am not able to catch it with "except
xml.parsers.expat.ExpatError:" It says "NameError: global name 'xml' is
not defined".

I am also not able to catch it with "except ExpatError:" Gives
"NameError: global name 'xml' is not defined"

How do I catch it? (I am parsing an xml file)

Also, how do I get the line number where an exception was thrown?

Thanks.

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


Re: How do I catch ExpatError exception?

2006-08-16 Thread Shuaib
Steve Holden wrote:

> import xml.parsers.expat


Thanks, that worked.


>
> def r():
>return 1/0
>
> try:
>print r()
> except:
>import sys
>t, v, tb = sys.exc_info()
>
> print "exception on line", tb.tb_lineno

How do I get the helpful text that is thrown with the exception? Like
if the exception is " IOError: [Errno 2] No such file or directory:
'out.xml' "

How do I get the the text after IOError: ?

Thanks again.

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


Embedding python: GCC gives errors of "undefined reference" to Py_* functions.

2006-08-19 Thread Shuaib
Hey!

I am trying to embedd python into a C programe of mine. But when I try
to compile the C code, gcc gives errors like "undefined reference to
`Py_Finalize'" and the same kind for all the other functions. I have
incuded "Python.h".

Any idea what might be wrong?

Thanks.

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


Re: Embedding python: GCC gives errors of "undefined reference" to Py_* functions.

2006-08-19 Thread Shuaib
OK, I am not ashamed to admit that I am ashamed as I didn't search the
group for my problem before posting it yet again. The solution was
right there.

I have link in my libpython2.4.so while compiling.

$gcc -I/usr/include/python2.4/ -lpython2.4  -o foo foo.c


Shuaib wrote:
> Hey!
>
> I am trying to embedd python into a C programe of mine. But when I try
> to compile the C code, gcc gives errors like "undefined reference to
> `Py_Finalize'" and the same kind for all the other functions. I have
> incuded "Python.h".
> 
> Any idea what might be wrong?
> 
> Thanks.

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


Embedding python: Segmentation Fault

2006-08-19 Thread Shuaib
Hi!

I am trying to embed python into a C programe of mine. When the
execution reaches the following line

pModule = PyImport_Import(pName);

It causes a Segmentation Fault Error. pModule is of type PyObject *, so
is pName.

What could be the possible reasons for the error?

Thanks for your time.

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


bug in python 3.10.4

2022-05-25 Thread Shuaib Akhtar
   When double clicking a .py file when have python install. It run file but
   at a spot of the program it stop running. But using the built-in ide for
   python this problem does not happen also any other ide it work fine

    

    

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


need help

2022-10-23 Thread Shuaib Akhtar
   How to fix Traceback (most recent call last):

     File "C:\Program
   
Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\socket.py",
   line 833, in create_connection

       sock.connect(sa)

   TimeoutError: [WinError 10060] A connection attempt failed because the
   connected party did not properly respond after a period of time, or
   established connection failed because connected host has failed to respond

    

   During handling of the above exception, another exception occurred:

    

   Traceback (most recent call last):

     File "C:\Users\i9shu\Downloads\python email bot\email bot.py", line 25,
   in 

       server = smtplib.SMTP('smtp.gmail.com',2525)

     File "C:\Program
   
Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\smtplib.py",
   line 255, in __init__

       (code, msg) = self.connect(host, port)

     File "C:\Program
   
Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\smtplib.py",
   line 341, in connect

       self.sock = self._get_socket(host, port, self.timeout)

     File "C:\Program
   
Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\smtplib.py",
   line 312, in _get_socket

       return socket.create_connection((host, port), timeout,

     File "C:\Program
   
Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0\lib\socket.py",
   line 833, in create_connection

       sock.connect(sa)

   KeyboardInterrupt

    

   Process finished with exit code -1073741510 (0xC13A: interrupted by
   Ctrl+C)

   eorr

    

   Sent from [1]Mail for Windows

    

References

   Visible links
   1. https://go.microsoft.com/fwlink/?LinkId=550986
-- 
https://mail.python.org/mailman/listinfo/python-list