Re: Multiprocessing "Pool" aborts without any error message or return code? (Python 3.6.4, cygwin 32 bit, Windows Server 2012)

2018-08-13 Thread Niels Kristian Jensen
fredag den 10. august 2018 kl. 15.35.46 UTC+2 skrev Niels Kristian Jensen:
> Please refer to:
> 
(cut)

It appears, that Python is simply not supported on Cygwin (!):

https://bugs.python.org/issue30563

Best regards,
Niels Kristian
-- 
https://mail.python.org/mailman/listinfo/python-list


Multiprocessing "Pool" aborts without any error message or return code? (Python 3.6.4, cygwin 32 bit, Windows Server 2012)

2018-08-10 Thread aenkaa
Please refer to:

https://docs.python.org/3.6/library/multiprocessing.html

the first example program. If I run it on Windows 10 (Python 3.6.4) or Linux 
Mint 18 (Python 3.5.2), it works as expected.

On Windows Server 2012, however, I get no (none!) output, no matter if I run 
with admin rights or not:

adminnkj@DTDKCPHAS1060 ~
$ python3 -V
Python 3.6.4

adminnkj@DTDKCPHAS1060 ~
$ cat test.py
from multiprocessing import Pool

def f(x):
return x*x

if __name__ == '__main__':
p = Pool(5)
print(p.map(f, [1, 2, 3]))


adminnkj@DTDKCPHAS1060 ~
$ python3 test.py

---> NB: no output <---

adminnkj@DTDKCPHAS1060 ~
$ echo $?
0

---> NB: Normal exit code <---


I am a bit lost, running with -v -vv or -vvv does not help me much (here are 
the last lines of the latter):

(cut)

import 'multiprocessing.connection' # 
<_frozen_importlib_external.SourceFileLoader object at 0xffc913f0>
import 'multiprocessing.queues' # <_frozen_importlib_external.SourceFileLoader 
object at 0xffc7ab10>
# trying 
/usr/lib/python3.6/multiprocessing/synchronize.cpython-36m-i386-cygwin.dll
# trying /usr/lib/python3.6/multiprocessing/synchronize.abi3.dll
# trying /usr/lib/python3.6/multiprocessing/synchronize.dll
# trying /usr/lib/python3.6/multiprocessing/synchronize.py
# /usr/lib/python3.6/multiprocessing/__pycache__/synchronize.cpython-36.pyc 
matches /usr/lib/python3.6/multiprocessing/synchronize.py
# code object from 
'/usr/lib/python3.6/multiprocessing/__pycache__/synchronize.cpython-36.pyc'
import 'multiprocessing.synchronize' # 
<_frozen_importlib_external.SourceFileLoader object at 0xffc91af0>
# trying 
/usr/lib/python3.6/multiprocessing/popen_fork.cpython-36m-i386-cygwin.dll
# trying /usr/lib/python3.6/multiprocessing/popen_fork.abi3.dll
# trying /usr/lib/python3.6/multiprocessing/popen_fork.dll
# trying /usr/lib/python3.6/multiprocessing/popen_fork.py
# /usr/lib/python3.6/multiprocessing/__pycache__/popen_fork.cpython-36.pyc 
matches /usr/lib/python3.6/multiprocessing/popen_fork.py
# code object from 
'/usr/lib/python3.6/multiprocessing/__pycache__/popen_fork.cpython-36.pyc'
import 'multiprocessing.popen_fork' # 
<_frozen_importlib_external.SourceFileLoader object at 0xffc57190>

then it exits with no further output.

Best regards,
Niels Kristian Jensen (from Denmark)
-- 
https://mail.python.org/mailman/listinfo/python-list


Where is import defined in the source code? (python 2)

2016-09-21 Thread Peng Yu
Hi, I want know where import is defined in the source code. Is it
implemented using __import__?

-- 
Regards,
Peng
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: code python

2014-12-21 Thread Rustom Mody
On Saturday, December 20, 2014 7:30:20 AM UTC+5:30, Khetam Yassen wrote:
> Hello all
> I Have problem about , How i can compute accuracy to unigram,bigram and 
> trigram
> and how i can change the size to iteration separate from 1 to 10 in each 
> stage from iteration train take 90% and training 10%.
> thank you to read my message

Assuming this is about nltk, your subject line needs to say that.
Also may be better to ask on an nltk-specific list
https://groups.google.com/forum/#!forum/nltk-users
-- 
https://mail.python.org/mailman/listinfo/python-list


code python

2014-12-19 Thread Khetam Yassen
Hello all
I Have problem about , How i can compute accuracy to unigram,bigram and trigram
and how i can change the size to iteration separate from 1 to 10 in each stage 
from iteration train take 90% and training 10%.
thank you to read my message
import codecs
import nltk
from nltk import*

outfile = codecs.open('unigram_tagged_sents_out.txt','w','utf-8')
outfile2 = codecs.open('bigram_tagged_sents_out.txt','w','utf-8')
outfile3 = codecs.open('trigram_tagged_sents_out.txt','w','utf-8')
File1=codecs.open('C:\project\Corpus_word.txt','r','utf_8').readlines()
word_pos_list = []
tokens=[]
train_sents=[]
test_tagged_sents=[]
all_test_sents = []
n=10


for line in File1:
tokens = line.split('\t')
#print '%s\t%s\t%s' % (tokens[0], tokens[1], tokens[2])
word_pos_list.append((tokens[0], tokens[1]))
all_test_sents.append(tokens[0])

for t in range(10):  
size=int(len(word_pos_list)*(0.9))
#print size
train_sents.append(word_pos_list[:size])
test_tagged_sents.append(word_pos_list[size:])
test_sents=all_test_sents[size:]

print "unigram tagger"
#Unigram tagger

unigram_tagger = nltk.UnigramTagger(train_sents)
tagged_unigram_sents = unigram_tagger.tag(test_sents)
print unigram_tagger.evaluate(test_tagged_sents)
for (word, tag) in tagged_unigram_sents:
 print>>outfile, '%s\t%s' % (word, tag)
print nltk.accuracy(tagged_unigram_sents,test_sents) 


#bigram tagger
print "Bigram Tagger"
bigram_tagger = nltk.BigramTagger(train_sents,backoff= unigram_tagger)
tagged_bigram_sents=bigram_tagger.tag(test_sents)
print bigram_tagger.evaluate(test_tagged_sents)
for (word, tag) in tagged_bigram_sents:
 print>>outfile2, '%s\t%s' % (word, tag)
   

#Trigram tagger
print "Trigram Tagger"

trigram_tagger=nltk.TrigramTagger(train_sents,backoff= bigram_tagger)
tagged_trigram_sents=trigram_tagger.tag(test_sents)
print trigram_tagger.evaluate(test_tagged_sents)
for (word, tag) in tagged_trigram_sents:
print>>outfile3, '%s\t%s' % (word, tag)
outfile.close()
outfile2.close()
outfile3.close()

print 'Done!'
#accuracy = unigram_tagger.evaluate(tagged_test_sents)
#print 'accuracy = ', accuracy
#train_sents.append((word_pos_list[:size]))
#print train_sents
#test_sents.append(word_pos_list[size:])
#print test_sents
#bigram_tagger=nltk.BigramTagger(train_sents)
#print bigram_tagger.tag(tokens[:size])
#print bigram_tagger._train(train_sents,cutoff=size)

#print bigram_tagger.evaluate(test_sents)

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


Re: what is wrong in my code?? (python 3.3)

2013-09-30 Thread Piet van Oostrum
dream4s...@gmail.com writes:

> I rename file from test.py in test.txt and all works fine. So clearly problem 
> it is not in file coding or browser. ANY IDEAS??

It looks like the encoding of stdout is not utf-8 in the CGI script. Check it 
with

import sys
print(sys.stdout.encoding)

If it's not utf-8, you must force your output to be utf-8, as that is what the 
browser expects, because of your Content-type.

You could use: 
sys.stdout.buffer.write('ранее предусматривалась смертная 
казнь.'.encode('utf-8'))

Or to change stdout into utf-8 encoding:

import codecs
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())

[Note: I haven't tested this]
-- 
Piet van Oostrum 
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: what is wrong in my code?? (python 3.3)

2013-09-30 Thread dream4soul
On Friday, September 27, 2013 7:19:45 PM UTC+3, Denis McMahon wrote:
> On Fri, 27 Sep 2013 06:54:48 -0700, dream4soul wrote:
> 
> 
> 
> > #!c:/Python33/python.exe -u
> 
> > import os, sys 
> 
> > print("Content-type: text/html; charset=utf-8\n\n")
> 
> > print ('Hello, world!')
> 
> > print('ранее предусматривалась смертная казнь.')
> 
> 
> 
> > I see only first print, second it just question marks in my browser(code
> 
> > edited in notepad++ with UTF-8 encode). what is wrong??
> 
> 
> 
> Sounds like your browser is ignoring the charset. Can you force the 
> 
> browser to utf-8?
> 
> 
> 
> What happens if you create a plain html file with the same content and 
> 
> send it to your browser?
> 
> 
> 
> eg: test.html:
> 
> -
> 
> Hello, world!
> 
> ранее предусматривалась смертная казнь.
> 
> -
> 
> 
> 
> This really doesn't look like a python issue (again).
> 
> 
> 
> -- 
> 
> Denis McMahon, denismfmcma...@gmail.com

I rename file from test.py in test.txt and all works fine. So clearly problem 
it is not in file coding or browser. ANY IDEAS??
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: what is wrong in my code?? (python 3.3)

2013-09-27 Thread Denis McMahon
On Fri, 27 Sep 2013 06:54:48 -0700, dream4soul wrote:

> #!c:/Python33/python.exe -u
> import os, sys 
> print("Content-type: text/html; charset=utf-8\n\n")
> print ('Hello, world!')
> print('ранее предусматривалась смертная казнь.')

> I see only first print, second it just question marks in my browser(code
> edited in notepad++ with UTF-8 encode). what is wrong??

Sounds like your browser is ignoring the charset. Can you force the 
browser to utf-8?

What happens if you create a plain html file with the same content and 
send it to your browser?

eg: test.html:
-
Hello, world!
ранее предусматривалась смертная казнь.
-

This really doesn't look like a python issue (again).

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [CODE] - Python Newcomer Starting with Coding

2006-03-21 Thread Dave Hansen
On Tue, 21 Mar 2006 20:05:48 +0200 in comp.lang.python, Ilias
Lazaridis <[EMAIL PROTECTED]> wrote:

>bruno at modulix wrote:
[...]
>> Look for the Python cookbook (google is your friend).
>...
>
>http://www.oreilly.com/catalog/pythoncook/
>
>sorry, I've not clarified that I mean an free internet resource.

Try the first hit from google rather than the third.

http://aspn.activestate.com/ASPN/Python/Cookbook/

Regards,
-=Dave

-- 
Change is inevitable, progress is not.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [CODE] - Python Newcomer Starting with Coding

2006-03-21 Thread Ilias Lazaridis
Ed Singleton wrote:
> On 21/03/06, Ilias Lazaridis <[EMAIL PROTECTED]> wrote:
>> Where can I find practical coding examples for real life coding problems?
>>
>> Something like a categorized solution guide?
>>
> 
> This sounds quite a lot like PLEAC.  It certainly contains a lot that
> you would find useful.
> 
> http://pleac.sourceforge.net/pleac_python/index.html

yes, this looks like the resource I was looking for.

> Also, try using the python-tutor list.  It's a lot more helpful for
> questions like these.

I've subscribed via gmane's nntp:

news://news.gmane.org:119/gmane.comp.python.tutor

will take a close look to this list.

>> My current problem:
>>
>> * create a folder
>>* seems to be: os.mkdir(path)
> 
> Try using the Path module.  It makes all that stuff much easier:
> 
> http://www.jorendorff.com/articles/python/path/

looks very intresting.

for now I am limited to the standard library.

but I will for sure take a deeper look in near future.

.

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


Re: [CODE] - Python Newcomer Starting with Coding

2006-03-21 Thread Ilias Lazaridis
bruno at modulix wrote:
> Ilias Lazaridis wrote:
>> Where can I find practical coding examples for real life coding problems?
> 
> Probably in real life code ?-)
> 
>> Something like a categorized solution guide?
> 
> Look for the Python cookbook (google is your friend).
...

http://www.oreilly.com/catalog/pythoncook/

sorry, I've not clarified that I mean an free internet resource.

>> * copy the content of the package folder to the created folder
> 
> import shutil
> help(shutil.copytree)
...

this one was helpfull.

thanks a lot.

.

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


Re: [CODE] - Python Newcomer Starting with Coding

2006-03-21 Thread Ed Singleton
On 21/03/06, Ilias Lazaridis <[EMAIL PROTECTED]> wrote:
> Where can I find practical coding examples for real life coding problems?
>
> Something like a categorized solution guide?
>

This sounds quite a lot like PLEAC.  It certainly contains a lot that
you would find useful.

http://pleac.sourceforge.net/pleac_python/index.html

Also, try using the python-tutor list.  It's a lot more helpful for
questions like these.

>
> My current problem:
>
> * create a folder
>* seems to be: os.mkdir(path)

Try using the Path module.  It makes all that stuff much easier:

http://www.jorendorff.com/articles/python/path/

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


Re: [CODE] - Python Newcomer Starting with Coding

2006-03-21 Thread bruno at modulix
Ilias Lazaridis wrote:
> Where can I find practical coding examples for real life coding problems?

Probably in real life code ?-)

> Something like a categorized solution guide?

Look for the Python cookbook (google is your friend).

> -
> 
> My current problem:
> 
> * create a folder
>   * seems to be: os.mkdir(path)

I wouldn't even count this as a coding problem, except perhaps for a
total CS newbie.

> * obtain the path of a python package

import package
print package.__file__

> * copy the content of the package folder to the created folder

import shutil
help(shutil.copytree)

(snip)

> I've looked in the Python 2.4 documentation, but the resulting
> possibilities are too much.

???


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
-- 
http://mail.python.org/mailman/listinfo/python-list


[CODE] - Python Newcomer Starting with Coding

2006-03-21 Thread Ilias Lazaridis
Where can I find practical coding examples for real life coding problems?

Something like a categorized solution guide?

-

My current problem:

* create a folder
   * seems to be: os.mkdir(path)

* obtain the path of a python package

* copy the content of the package folder to the created folder

alternatively (which would possibly preserve the file-attributes)

* obtain the path of a python package

* copy the content of the package folder to the destination folder, 
whlist giving a new name.

I've looked in the Python 2.4 documentation, but the resulting 
possibilities are too much.

Any suggestions welcome.

.

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


Re: Cheapest pocket device to code python on

2005-12-03 Thread adDoc's networker Phil
. I could actually touch-type on the psion (a genuine [/]pocket computer!)
but I was looking forward to eventually writing a key mapper
(new key layouts are always an aggravation)
. my plans were snipped in the bud however,
because I got cheap and tried to sneak around the warranty with a universal ac adaptor;
I didn't check the voltage myself with a meter,
and found out the hard way that it was putting out twice the expected voltage
. apparently a lot of other people were making mistakes like that,
because shortly after psion arrived from the uk,
they dropped customer service for the usa
-- except the corporate acct's, 
where they could deal with professional IT staff who didn't need their nose wiped !
On 11/26/05, Ten <[EMAIL PROTECTED]> wrote:
I use an old epocpython on a Psion Revo Plus for jotting down python conceptsand testing out ideas, and I wouldn't be without it - especially because theRevo keyboard is usable in a way touchscreens aren't for me.
It's not the most extensive python installation, and it won't stand muchearthshifting (it doesn't include some modules, like tkinter) but it's a hellof a lot of portable python considering the fact you can pick one up for
around 10 to 20 squids on ebay.Better keyboard than a pda, portable python for next to nothing.--http://mail.python.org/mailman/listinfo/python-list
-- American Dream Documentshttp://www.geocities.com/amerdreamdocs/home/"(real opportunity starts with real documentation)
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Cheapest pocket device to code python on

2005-11-26 Thread Ten
On Friday 04 November 2005 03:55, [EMAIL PROTECTED] wrote:
> What is the cheapest/affordable pocket device that I can code python
> on? I think the closest I have seen is pocketpc from this page:
>
> http://www.murkworks.com/Research/Python/PocketPCPython/Overview

Depends what you're using it for, and how cheap you mean.

Having seen the PocketPC angle covered, I may as well cover a different angle 
give an even cheaper option.

I use an old epocpython on a Psion Revo Plus for jotting down python concepts
and testing out ideas, and I wouldn't be without it - especially because the 
Revo keyboard is usable in a way touchscreens aren't for me.

It's not the most extensive python installation, and it won't stand much 
earthshifting (it doesn't include some modules, like tkinter) but it's a hell 
of a lot of portable python considering the fact you can pick one up for 
around 10 to 20 squids on ebay.

Better keyboard than a pda, portable python for next to nothing.

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


Re: Cheapest pocket device to code python on

2005-11-04 Thread adDoc's networker Phil
On 3 Nov 2005 19:55:03 -0800, [EMAIL PROTECTED]
 <[EMAIL PROTECTED]
> wrote:What is the cheapest/affordable pocket device that I can code python

on? I think the closest I have seen is pocketpc from this page:http://www.murkworks.com/Research/Python/PocketPCPython/Overview


   Cameron Laird <
[EMAIL PROTECTED]>
 wrote:


   achieves stunning results with his tiny PocketPC Magician 


http://wiki.tcl.tk/HTC%20Magician. the cheapest pocketpc might be dell refurbished .

$319.00 
Axim X50v Advanced Graphics 624 Mhz and VGA display

(remember vga -- that was desktop! )

google dell axim refurbished 
. if your time is worth a lot,
then a larger screen for $350 
might be cheaper than the typical $200 
. pda's have been my idea of a cheap desktop replacement;
but I've been through a lot of add-on keyboards,
. so now I'm looking at my python.ce as more for 
running programs that I wrote elsewhere, 
such as:
my new walkable" Fujitsu P1500D 
(an xp pro tablet with a complete but reduced-sized kybd)

 [EMAIL PROTECTED] http://www.computers.us.fujitsu.com/images/swf/P1500D/P1500D.html

. it should be here in 2 weeks;

and then I can -- with harness holding the laptop on my chest --
walk around downtown Spokane Wa 
connected to the free wifi broadband
and there are briefcase-sized batt`s to keep a walker`s costs down

[EMAIL PROTECTED] http://www.lowes.com/lowes/lkn?action=""


. even when tablets have a cheap screen that can't compete with the sun,
walkables are convenient at libraries
because I can easily touch-type my log 
while jumping between catalog and shelves
-- I've already made one for my axim and it`s plug-in keyboard:
I added straps and drawstrings to the 
clamshell of a spent palm keyboard .
-- American Dream Documentshttp://www.geocities.com/amerdreamdocs/home/
"(real opportunity starts with real documentation)

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

Re: Cheapest pocket device to code python on

2005-11-04 Thread Cameron Laird
In article <[EMAIL PROTECTED]>,
Sybren Stuvel  <[EMAIL PROTECTED]> wrote:
>Devan L enlightened us with:
>> I would not recommend trying to code on a handheld device. Small
>> screen size and [usually] small keyboards make it
>> less-than-practical. Stick with a laptop, or write it in a notebook,
>> if you must.
>
>Although it isn't the pinnacle of usability, I can program just fine
>on my Sharp Zaurus C3000.
>
>Having said that, a real PC is a lot nicer to work on. But then, if
>you want to have a really portable programming thiny, the Zaurus is
>great.
>
>Not too cheap though.
.
.
.
A colleague who works with Tcl (for this purpose, think of it
as Python, except different) achieves stunning results with
his tiny PocketPC Magician.  For inspiration, see http://wiki.tcl.tk/HTC%20Magician >.  Richard makes me want
such a device, even though I orient exceedingly strongly to
full-size keyboards.  Incidentally, the Samsung 730 is another
I'm considering.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Cheapest pocket device to code python on

2005-11-04 Thread Magnus Lycka
[EMAIL PROTECTED] wrote:
> What is the cheapest/affordable pocket device that I can code python
> on? I think the closest I have seen is pocketpc from this page:

A used Fujitsu Lifebook running Linux and fairly large pockets? ;)

There is some version of Python running on Palms, but it's stripped
down, and I haven't tried it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Cheapest pocket device to code python on

2005-11-04 Thread Sybren Stuvel
Devan L enlightened us with:
> I would not recommend trying to code on a handheld device. Small
> screen size and [usually] small keyboards make it
> less-than-practical. Stick with a laptop, or write it in a notebook,
> if you must.

Although it isn't the pinnacle of usability, I can program just fine
on my Sharp Zaurus C3000.

Having said that, a real PC is a lot nicer to work on. But then, if
you want to have a really portable programming thiny, the Zaurus is
great.

Not too cheap though.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
 Frank Zappa
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Cheapest pocket device to code python on

2005-11-03 Thread Devan L

[EMAIL PROTECTED] wrote:
> What is the cheapest/affordable pocket device that I can code python
> on? I think the closest I have seen is pocketpc from this page:
>
> http://www.murkworks.com/Research/Python/PocketPCPython/Overview

I would not recommend trying to code on a handheld device. Small screen
size and [usually] small keyboards make it less-than-practical. Stick
with a laptop, or write it in a notebook, if you must.

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


Cheapest pocket device to code python on

2005-11-03 Thread theboringdays
What is the cheapest/affordable pocket device that I can code python
on? I think the closest I have seen is pocketpc from this page:

http://www.murkworks.com/Research/Python/PocketPCPython/Overview

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