[issue33011] Embedded 3.6.4 distribution does not add script parent as sys.path[0]

2018-03-06 Thread Cong Monkey
Change by Cong Monkey <congzhan...@gmail.com>: -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware type: -> behavior ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33011] Embedded 3.6.4 distribution does not add script parent as sys.path[0]

2018-03-06 Thread Cong Monkey
New submission from Cong Monkey <congzhan...@gmail.com>: Embedded 3.6.0 distribution does not insert script parent in sys.path[0], but the normal python do it. this make some failed, like when I try to do pip install future, it will failed as import src.future failed, which works for

py2exe with python 3.x

2012-11-05 Thread Monkey
Hi, i wonderd if there is a way to convert a py-file to a exe-file with version 3.x of python. I know that it was possible till version 2.7.x. But is there a way to do it in version 3.x? Yours sincerely, Monkey -- http://mail.python.org/mailman/listinfo/python-list

CDA conversion

2008-01-31 Thread Sick Monkey
Good evening. I am trying to write an application in Python that will allow a person to insert a CD into their computer and this python script will convert the music to mp3. NOTE: I have already google'd this, and nothing really pops out at me. I found tons of applications that does this, but

WXPython - Using inline images

2008-01-01 Thread Sick Monkey
I have a question about WXPython and using inline images. The code that I have included into this email comes from the following URL: http://www.daniweb.com/code/snippet654.html As you can see from the code below, that this application will take an inline JPG image, and will create a

POP3 - Saving an image attachment only.

2007-08-27 Thread Sick Monkey
I wrote some code below (Code1 block) which will read a pop3 email account and will open each email in the inbox. What I want my code to do is only pull the attachment; as you see below I basically output everything. Is there an easy way to just pull attachments? (NOTE, the only attachements

Re: ImageMagick Issue

2007-05-31 Thread Sick Monkey
[EMAIL PROTECTED] wrote: Sick Monkey wrote: When I run the following command: [EMAIL PROTECTED] david.huggins]# identify -format %w '/someDIR/images/david.huggins/100_0264.JPG' From Python interpreter: cmd = identify -format %w test.jpg p = subprocess.Popen(cmd.split(), stdout

ImageMagick Issue

2007-05-30 Thread Sick Monkey
I have the following: OS = RedHat ImagMagick installed. Python v2.5 - When I run the following command: [EMAIL PROTECTED] david.huggins]# identify -format %w '/someDIR/images/david.huggins/100_0264.JPG' I get the following result 2304 However, when I try

Re: py2exe compiling

2007-05-22 Thread Sick Monkey
Have you looked at the Tips and Tricks on Py2exe's website? http://www.py2exe.org/index.cgi/GeneralTipsAndTricks I believe this next link will help you add custom data to your app. http://www.py2exe.org/index.cgi/CustomDataInExe .dave On 5/21/07, Pyro [EMAIL PROTECTED] wrote: Hello, I have

interesting dict bug

2007-05-19 Thread Sick Monkey
Here is a segment of some code that I have. CODE: -- print filename params2 = {'filename':filename,'id3title':title,'id3artist':artist,'id3album':album,'id3year':year,'id3track':track,'id3genre':genre,'uname':username,'password':password,'filesToUpload':open(file, 'rb')} print

Re: interesting dict bug

2007-05-19 Thread Sick Monkey
' in the 'print filename' line as it isn't actually part of the data. You will see it in the 'print params2' output, though, as I believe it relies on the string object's __repr__ function, which will include the unicode specifier. -Jeff On 5/19/07, Sick Monkey [EMAIL PROTECTED] wrote: Here is a segment

wxpython - button question

2007-05-18 Thread Sick Monkey
I have the following code which will basically take an image file and create a bitmap image. I am having one problem though in that there is a white border around the image. Does anyone know how to take that off? imageFile2 = image.png image2 = wx.Image(imageFile2,

Re: file uploader

2007-05-13 Thread Sick Monkey
),.-%s % (i)) i += 1 req.write(filename) % The directory contains the following files: whoa.mp3 and whoa.mp3.-0. This code will output whoa.mp3.-1. On 5/9/07, Sick Monkey [EMAIL PROTECTED] wrote: Hey guys. I wanted to write a little desktop application that would upload files to an external

Re: append

2007-05-10 Thread Sick Monkey
http://docs.python.org/tut/node7.html Yes there is a pop function. An example that uses most of the list methods: a = [66.25, 333, 333, 1, 1234.5] print a.count(333), a.count(66.25), a.count('x') 2 1 0 a.insert(2, -1) a.append(333) a [66.25, 333, -1, 333, 1, 1234.5, 333] a.index(333) 1

file uploader

2007-05-09 Thread Sick Monkey
Hey guys. I wanted to write a little desktop application that would upload files to an external server, to a specific directory. The desktop application is running on Mac OS X and I built a .psp script that is running on a Red Hat server. NOTE: This application is written for Python 2.5 (both

Re: recursively removing files and directories

2007-04-09 Thread Sick Monkey
Here is some code that could be useful It does not check the directories for 0 files, but that shouldn't be too difficult to add. # from os import listdir, unlink from os.path import isdir, isfile, islink, join, getmtime deldir = C:\Some\Dir

Re: Looping issues

2007-04-05 Thread Sick Monkey
Try this. NOTE: The script below will compare lines of both files (even hidden characters such as \n)... def fopen(fname): try: return open(fname, 'U') except IOError, detail: return fail(couldn't open + fname

Re: Looping issues

2007-04-05 Thread Sick Monkey
)) f1 = fopen('file1.txt') a = f1.readlines(); f1.close() d1 = {} for c in a: d1[c.lower()] = None #print d1 f2 = fopen('file2.txt') data = f2.readlines(); f2.close() for line in data: if d1.has_key( line.lower() ): print line On 4/5/07, Sick Monkey [EMAIL

Re: Cascading ifs

2007-04-05 Thread Sick Monkey
If it is just the indentation that is bothering you, you could do this: match = test if match == 1: print 1 elif match == 2: print 2 elif match == test: print test On 4/2/07, Ernesto García García [EMAIL PROTECTED] wrote: Hi experts, How would you do this without the more and more

Re: Python shell on mac os x

2007-03-15 Thread Sick Monkey
I use iTerm and it took me a while to get use to it as well. All you have to do is go to Bookmarks- Manage Profiles Then expand Terminal Profiles -Default and then for type select linux. You may have to restart iTerm, but you will be able to do everything you can in linux. Let me know if that

Re: Python Eggs on Cygwin

2007-03-15 Thread Sick Monkey
Just by looking at the permission denied error, when you loaded the MySQLdb module, were you using a specific user (is it owned by a specific user)? On 15 Mar 2007 17:33:29 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I'm trying to use MySQL Python module on Cygwin. Since there is

Re: Readline()

2007-03-12 Thread Sick Monkey
Maybe if you show us your code we can better assist you. But maybe you can use a global variable or a try-catch method to keep threads from staying alive and help better control your code. On 3/12/07, Taylor, Stuart [EMAIL PROTECTED] wrote: I have been working on running an external process

Re: making an executable for a python code (newbie)

2007-03-10 Thread Sick Monkey
You will probably want to read this documentation: http://pyinstaller.hpcf.upr.edu/docs/Manual_v1.1.html Look carefully at the following sections on the documentation: Building the runtime environment and Spec File and Spec File - EXE

Re: SQLAlchemy and Oracle Functions?

2007-03-08 Thread Sick Monkey
Helpful Links http://sourceforge.net/projects/cx-oracle http://www.python.net/crew/atuining/cx_Oracle/html/cursorobj.html == Example: Replace the data types as appropriate. v_Vars = v_Cursor.setinputsizes(p_Result = cx_Oracle.NUMBER) v_Cursor.execute( begin

Re: What is the best way to upgrade python?

2007-03-08 Thread Sick Monkey
Have you tried to upgrade the current python RPM? rpm -Uvh You can also build from source. Once you get Python 2.4 up and running I am pretty sure you can do a symbolic link on the python 2.3 application (either in /usr/bin or /usr/sbin) and point it to the 2.4 python file. On 8 Mar 2007

Re: What is the best way to upgrade python?

2007-03-08 Thread Sick Monkey
be distressed if you need to update or install new RPMs. On 3/8/07, ying lcs [EMAIL PROTECTED] wrote: On 3/8/07, Sick Monkey [EMAIL PROTECTED] wrote: Have you tried to upgrade the current python RPM? rpm -Uvh You can also build from source. Once you get Python 2.4 up and running I am

Re: py2exe: LoadLibrary(pythondll) failed

2007-03-03 Thread Sick Monkey
(1) You may want to read the following links: http://docs.python.org/dist/describing-extensions.html#SECTION00234 which came from: http://docs.python.org/dist/dist.html Here is another good resource for py2exe: http://www.py2exe.org/index.cgi/GeneralTipsAndTricks (2) Also, you

Python win32 tools

2007-03-01 Thread Sick Monkey
I am trying to build a python program that will reset a user's account (password) on a windows machine (NOTE: my intention here is not to implement anything malicious {and I know about Trinity which is very useful}, but I just wanted a challenge and do it myself.). I have been working with win32

Re: Py2EXE problem

2007-02-28 Thread Sick Monkey
application needed and inserted them in the email folder within the library.zip. I fired up the application and it worked like a champ. On 2/27/07, Sick Monkey [EMAIL PROTECTED] wrote: Maybe this is not the board to post this, but hopefully with all of the python experts out there maybe one

Re: Py2EXE problem

2007-02-28 Thread Sick Monkey
Awesome. That is good to know. On 2/28/07, Thomas Heller [EMAIL PROTECTED] wrote: Sick Monkey schrieb: Ok I found an extremely easy way to resolving this issue (I cannot believe I did not think of it sooner). After Py2exe created the .exe file I noticed a library.zip file. I took a look

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread Sick Monkey
Here you are: from win32com.client import GetObject wmiObj = GetObject(winmgmts:MGW01641\\root\\cimv2) diskinfo = wmiObj.ExecQuery(Select * from Win32_LogicalDisk) for disk in diskinfo: ...print disk.Name, disk.FreeSpace ... A: None C: 16978259968 D: None On 28 Feb 2007 12:26:31

Re: How to check for remaining hard drive space in Windows?

2007-02-28 Thread Sick Monkey
Sorry, I forgot to make a change. You will need to change COMPUTER_NAME ~~~ from win32com.client import GetObject wmiObj = GetObject(winmgmts:COMPUTER_NAME\\root\\cimv2) diskinfo = wmiObj.ExecQuery(Select * from Win32_LogicalDisk) for disk in diskinfo:

Re: text wrapping help

2007-02-28 Thread Sick Monkey
I am not certain if I understand your problem, but I think you are just trying to read in a string and create a visable matrix. If that is true, then may some of the code below will work. This is in no way elegant. ++ count = 1 width = 2

Re: pyHook or SetWindowsHookEx

2007-02-28 Thread Sick Monkey
I have just gotten into pyHook, so I could be incredibly wrong, but I have researched a lot into your problem. (cuz I have the same question) I think the python program has to be on the remote machine becuase from my understanding pyHook just reads in the windows' keyboard driver. And when you

Re: os.system and quoted strings

2007-02-27 Thread Sick Monkey
Do you mean: import time, os dir = C:\\Documents and Settings\\somepath\\ fileName = time.strftime(%d%m%Y) finalname = %s%s.txt % (dir,fileName) print finalname C:\Documents and Settings\somepath\27022007.txt On 27 Feb 2007 06:24:41 -0800, svata [EMAIL PROTECTED] wrote: Hello, as I'm new

Re: book for a starter

2007-02-27 Thread Sick Monkey
I personally would get Programming Python, Third Edition http://www.oreilly.com/catalog/python3/ On 2/27/07, Wensui Liu [EMAIL PROTECTED] wrote: Good morning, all, I just start learning python and have a question regarding books for a newbie like me. If you are only allowed to buy 1 python

Special Characters

2007-02-27 Thread Sick Monkey
I have a quick question about handling values with special characters. Lets say I have a file which contains: == blah#blah == Here is what I have for my code: f6 = open(fileAttached) msInfo = f6.readlines(); f6.close()

Re: Special Characters

2007-02-27 Thread Sick Monkey
= varName.strip() On 2/27/07, Sick Monkey [EMAIL PROTECTED] wrote: I have a quick question about handling values with special characters. Lets say I have a file which contains: == blah#blah == Here is what I have for my code: f6

Py2EXE problem

2007-02-27 Thread Sick Monkey
Maybe this is not the board to post this, but hopefully with all of the python experts out there maybe one of you have encountered this. I wrote an application that sends an email with an attachment. When I run it, it runs great with no issues what-so--ever. When I thought I was finally

Re: getting info on remote files

2007-02-26 Thread Sick Monkey
You should use os.popen() instead of os.system. os.popen() will return a file-like object that is connected to the stdout of the system command; you can then use that object's read()/readlines() method(s) to assign that output to a Python variable. http://docs.python.org/lib/module-popen2.html

Re: Walk thru each subdirectory from a top directory

2007-02-26 Thread Sick Monkey
I had a do something similar. I had to get a program to traverse through a directory and delete all files with a specific file extension. (The program below will delete files, so I do not recommend you running it without paying close attention to it.) This program will start at a given

Re: Python Threads

2007-02-22 Thread Sick Monkey
] wrote: En Sun, 18 Feb 2007 23:37:02 -0300, Sick Monkey [EMAIL PROTECTED] escribió: Well if this cannot be done, can a thread call a function in the main method? I have been trying and have not been successive. Perhaps I am using thread incorrectly. The safe way to pass information between

Re: Regd. converting seconds to hh:mm:ss format

2007-02-20 Thread Sick Monkey
Do you mean epoch time? if so, the below example would work. import time,datetime t = datetime.datetime.now() print t 2007-02-20 13:09:34.851000 print Epoch Seconds:, time.mktime(t.timetuple()) Epoch Seconds: 1171994974.0 # go the other way epochtime = 1171994974 now =

Re: Python Threads

2007-02-19 Thread Sick Monkey
Great, thanks for the tip Gabriel! On 2/18/07, Gabriel Genellina [EMAIL PROTECTED] wrote: En Sun, 18 Feb 2007 23:37:02 -0300, Sick Monkey [EMAIL PROTECTED] escribió: Well if this cannot be done, can a thread call a function in the main method? I have been trying and have not been

Python Threads

2007-02-18 Thread Sick Monkey
Is there anyway to get 2 python threads to talk to one another? I have a GUI which is spawning a thread to make a large calculation (that way the GUI does not appear to be non responsive). I am trying to attach a progress bar to the threaded action. As the thread is calculating data, I would

Re: Python Threads

2007-02-18 Thread Sick Monkey
Well if this cannot be done, can a thread call a function in the main method? I have been trying and have not been successive. Perhaps I am using thread incorrectly. On 2/18/07, Sick Monkey [EMAIL PROTECTED] wrote: Is there anyway to get 2 python threads to talk to one another? I have a GUI

Another Dictionary Question

2007-02-08 Thread Sick Monkey
Hello All. I have a question concerning searching data within dictionaries. Lets say I have a dictionary called db. db = {'[EMAIL PROTECTED]':'none', '[EMAIL PROTECTED]':'none', '[EMAIL PROTECTED]':'none', '[EMAIL PROTECTED]':'none',} And I want to pull out all of the gmail.com addresses..

Dictionary/Hash question

2007-02-06 Thread Sick Monkey
Even though I am starting to get the hang of Python, I continue to find myself finding problems that I cannot solve. I have never used dictionaries before and I feel that they really help improve efficiency when trying to analyze huge amounts of data (rather than having nested loops). Basically

Re: Dictionary/Hash question

2007-02-06 Thread Sick Monkey
: En Tue, 06 Feb 2007 20:31:17 -0300, Sick Monkey [EMAIL PROTECTED] escribió: Even though I am starting to get the hang of Python, I continue to find myself finding problems that I cannot solve. I have never used dictionaries before and I feel that they really help improve efficiency when

Re: Dictionary/Hash question

2007-02-06 Thread Sick Monkey
22:18:07 -0300, Sick Monkey [EMAIL PROTECTED] escribió: I have never seen this with open(fname,'r') as finput: It is actually throwing an error . Do I have to import a special library to use this? File dictNew.py, line 23 with open(fname,'r') as finput: ^ SyntaxError

Re: PYTHONPATH or any other way to set seachpath (winXP) ?

2007-02-03 Thread Sick Monkey
If you need to extend your PATH variable, I have used this in the past. This should not require a reboot. ~~ def AddSysPath(new_path): new_path = os.path.abspath(new_path) do = -1 if os.path.exists(new_path): do = 1 # check

Re: Diff between opening files in 'r' and 'r+' mode

2007-01-30 Thread Sick Monkey
It was a little hard to follow your logic of your sample code (writing, reading and writing again), but (1)The difference between r and r+. - 'r+' opens the file for both reading and writing. - 'r' should be used when the file will only be read. I am not sure on how you want to store the

Re: Synchronous shutil.copyfile()

2007-01-30 Thread Sick Monkey
First off, I am just learning Python, so if there is a more efficient way to do this, then I am all ears (NOTE: The code below is something that I was messing with to learn threads... So some functionality is not applicable for your needs..I just wanted to show you a demonstration) One

difflib qualm

2007-01-24 Thread Sick Monkey
I am trying to write a python script that will compare 2 files which contains names (millions of them). More specifically, I have 2 files (Files1.txt and Files2.txt). Files1.txtcontains 180 thousand names and Files2.txt contains 34 million names. I have a script which will analyze these two

Re: OOPS concept

2005-05-05 Thread monkey
Google, search. km [EMAIL PROTECTED] ??? news:[EMAIL PROTECTED] ???... Hi all, Well this doesnt explain new style classes. let me be more clear. is there any online tutorial/ recommended book which deals explicitly with object oriented programming in python? regards, KM

Re: OOPS concept

2005-05-04 Thread monkey
Try this online book, it may help, the url is: http://www.byteofpython.info Hi all, Is there any good step by step online tutorial on OOPS concepts in python ? i have checked some on the python.org.__doc__ page but couldnt make much sense. especially i need help on newstyle classes.

Re: wxpython on cygwin for drPython - ImportError: No module named _core_

2005-05-04 Thread monkey
I install the original python(www.python.org), it works with wxpython and DrPython very very well. But your case seem to be due to DrPython is not programed for Cygwin. You should read through the system requirement of DrPython. As remember, it stated the www.python.org only ( ; Hi, Did

Re: Is python support jxta now?

2005-05-02 Thread monkey
Bittorrent, one of the most actively used p2p protocols is _written_ in python. Diez B. Roggisch Hey man, no, the jxta p2p protocols is not mean the bittorrent stuff. It is a fully decentralized network protocol, not confine to file transfer. --

Re: Comparision of GUI framworks

2005-05-02 Thread monkey
wxPython rules ( ; Go to http://wxpython.org for details... Florian Lindner [EMAIL PROTECTED] ??? news:[EMAIL PROTECTED] ???... Hello, I've read the chapter in the Python documentation, but I'm interested in a a more in-depth comparision. Especially regarding how pythonic it is and how well

wxPython: ansi or unicode?

2005-05-01 Thread monkey
Hi all, which should be install? Really confused @@... Is that mean unicode version used for programming in language other than English? -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython: ansi or unicode?

2005-05-01 Thread monkey
Many Thanks ( : Hi all, which should be install? Really confused @@... Unicode. Is that mean unicode version used for programming in language other than English? No. The Unicode version allows the underlying wxWidgets GUI toolkit to use Unicode text. You want this. On certain

Re: why import wx doesn't work?

2005-04-29 Thread monkey
They both work, thanks for your instruction ( : I suspect you are mixing program code for the namespace version (import wx) with the old method of importing (from wxPython.wx import *). Here are two version of a very simple app... try both and see if you get any errors. And if so, _please_

Re: why import wx doesn't work?

2005-04-29 Thread monkey
Bright ( ; You show me a crystal clear explaination. As a newbie in python and even oop, I find the python documentation is not easy to figure out. That's great with you guys so nice here. This is very good! wxApp is never defined if you use import wx. You must use wx.wxApp instead. If you

Re: OOP

2005-04-29 Thread monkey
Although I am a newbie in programming, I read from a java book (in my native language) saying that the purpose of Object Oriented Programming are: 1. Use a real world concept in constructing program (here everything are objects with there properties and methods/actions); 2. Simplify coding; 3.

Re: Can .py be complied?

2005-04-28 Thread monkey
Thx very much, I got the point now ( ; The latter. It's not completely self contained, there is an ..exe and some dll files that need to be distributed together. It's explained very clearly by the py2exe web site: http://starship.python.net/crew/theller/py2exe/ Never used google before?

why import wx doesn't work?

2005-04-28 Thread monkey
I just learn to make a blank windows frame with python and wxpython. I found the statment import wx cannot work as the original from wxPython.wx import *. I see in the readme file of wxpython that if I install it as the default one, I can use import wx instead of the long one. What is wrong? The

Re: why import wx doesn't work?

2005-04-28 Thread monkey
Which version of wxPython are you running? What do you mean by does not work...does the import fail or is your code giving errors? It is the current new version 2.6. The error message said that the class wxApp is not defined... But when using the default from wxPython.wx import *, it works.

Re: Can .py be complied?

2005-04-28 Thread monkey
python -o foo.exe foo.py Is that a real command that can be use? -- http://mail.python.org/mailman/listinfo/python-list

Re: why import wx doesn't work?

2005-04-28 Thread monkey
It is the current version of wxPython(2.6). But follow you instruction it still can't work... But if using the default from wxPython.wx import *, it work, don't know what is the problem. May be this is an old example that cannot work with import wx. Because I get another example and it is ok.

Which IDE is recommended?

2005-04-27 Thread monkey
Read through python site for programming tool, really plenty of choices :-) (For c++, I just can't breath with very very limited choices) Tried Spe, it come with wxGlade built-in very nice(is Spe still actively develop?). But seem that Boa Constructor and PyDev(the plug-in for Eclipse) also worth

Re: Can .py be complied?

2005-04-27 Thread monkey
And then example.pyc will appear beside example.py. This new file does not require example.py (you can even delete it), and works on any computer with Python installed Filip, you can read through my mind (-: You just told me what I want to know exactly, even I can't ask the question correctly.

Re: Can .py be complied?

2005-04-27 Thread monkey
But those files can be decompyled. Hi, so which way to go? -- http://mail.python.org/mailman/listinfo/python-list

Re: Which IDE is recommended?

2005-04-27 Thread monkey
What about eric? Good, it seem a very capable ide. But it require qt and for linux only? (can't find the system requirement) I have been using PyDev for some time, but i think it is not always very handsome (e.g. writing a 5-line script in vim needs less time than eclipse startup ;-) otoh,

Re: Can .py be complied?

2005-04-27 Thread monkey
py2exe has nothing to do with C or make files. You create a setup.py file containing a couple lines of python. You run that python program, and you end up with an .exe file and some associated .dll files. I typically use inno-setup to create an installer.exe that creates a desktop icon and

Re: Which IDE is recommended?

2005-04-27 Thread monkey
* Don't underestimate IDLE, it's surprisingly capable considering it's just a dinky little thing Yes, I believe IDLE is the a unbeatible last resort for python (-: * SPE has great features, but the pure-Python-ness makes it slow! Is it related to wxpython you mean? or program with GUI in tk

Can .py be complied?

2005-04-26 Thread monkey
Hi all, I am new to programming, already have a glace on introduction of c++, java and finally decided on python. But I found that the .py file is just like the source file, how can I make a program without revealing its source? (may be my question is a little bit stupid) --