ArchiveOrangemail archive

General discussion list for the Python programming language


python-list.python.org
(List home) (Recent threads) (97 other Python lists)

Subscription Options

  • RSS or Atom: Read-only subscription using a browser or aggregator. This is the recommended way if you don't need to send messages to the list. You can learn more about feed syndication and clients here.
  • Conventional: All messages are delivered to your mail address, and you can reply. To subscribe, send an email to the list's subscribe address with "subscribe" in the subject line, or visit the list's homepage here.
  • High traffic list: 30+ messages per day
  • This list contains about 646,417 messages, beginning Feb 1999
  • 56 messages added yesterday
Report the Spam
This button sends a spam report to the moderator. Please use it sparingly. For other removal requests, read this.
Are you sure? yes no

ucs2 and ucs4 python

Ad
Alan Kesselmann 1337076451Tue, 15 May 2012 10:07:31 +0000 (UTC)
Hello

I tried using one compiled library and got this error:
ImportError: /home/alan/Downloads/pdftron/PDFNetC64/Lib/
_PDFNetPython2.so: undefined symbol: PyUnicodeUCS2_AsUTF8String

I googled around and found some info about the meaning of the error.
The creators of PDFNet suggested i install UCS2 python next to my UCS4
version to try their library.

Can someone point me towards a resource or two which will tell me how
to do this - im not very good with whole linux/servers stuff. Im using
ubuntu linux - if that makes any difference.

Alan
Miki Tebeka 1337101049Tue, 15 May 2012 16:57:29 +0000 (UTC)
> Can someone point me towards a resource or two which will tell me how
> to do this - im not very good with whole linux/servers stuff. Im using
> ubuntu linux - if that makes any difference.Did not test, but this is the direction I would take:
* Download Python sources
* Open Terminal
* Run the following commands in the Terminal window
  - sudo apt-get build-dep python
  - tar -xjf Python-2.7.3.tar.bz2
  - cd Python-2.7.3
  - ./configure --prefix=/opt --enable-unicode=ucs2 && make
  - sudo make install
* Now you should have /opt/bin/python with ucs2

HTH--
Miki Tebeka 
http://pythonwise.blogspot.com
zayatzz 1337156855Wed, 16 May 2012 08:27:35 +0000 (UTC)
On May 15, 7:42 pm, Miki Tebeka  wrote:
> > Can someone point me towards a resource or two which will tell me how
> > to do this - im not very good with whole linux/servers stuff. Im using
> > ubuntu linux - if that makes any difference.
>
> Did not test, but this is the direction I would take:
> * Download Python sources
> * Open Terminal
> * Run the following commands in the Terminal window
>   - sudo apt-get build-dep python
>   - tar -xjf Python-2.7.3.tar.bz2
>   - cd Python-2.7.3
>   - ./configure --prefix=/opt --enable-unicode=ucs2 && make
>   - sudo make install
> * Now you should have /opt/bin/python with ucs2
>
> HTH
> --
> Miki Tebeka http://pythonwise.blogspot.comThanks for reply :)

And it seems to work... When i type in
/opt/bin/python
import sys
sys.maxunicode

then i get the desired answer - 65535

But it seems the work only begins now, because i cant use other python
libraries now with this version of python and i probably have to
install them all again somehow...

But thanks for your help :)

Alan
zayatzz 1337157751Wed, 16 May 2012 08:42:31 +0000 (UTC)
There is one problem though...

when i start script with shebang like
#!/opt/bin/python

and then try to run the script i get:

/opt/bin/python^M: bad interpreter: No such file or directory

/opt/bin/python
/opt/bin/python2
/opt/bin/python2.7 all start this new version of python, but none of
those work in shebang

Alan
Matej Cepl 1337159249Wed, 16 May 2012 09:07:29 +0000 (UTC)
On 16.5.2012 10:36, zayatzz wrote:
> /opt/bin/python^M: bad interpreter: No such file or directoryYour script has CRLF end-of-lines. Change it to plain Unix LF.

Matěj
zayatzz 1337160452Wed, 16 May 2012 09:27:32 +0000 (UTC)
On May 16, 11:50 am, Matej Cepl  wrote:
> On 16.5.2012 10:36, zayatzz wrote:
>
> > /opt/bin/python^M: bad interpreter: No such file or directory
>
> Your script has CRLF end-of-lines. Change it to plain Unix LF.
>
> MatějThanks :) but i have no idea what that means or how to achieve that.

Alan
Dave Angel 1337162248Wed, 16 May 2012 09:57:28 +0000 (UTC)
On 05/16/2012 05:20 AM, zayatzz wrote:
> On May 16, 11:50 am, Matej Cepl  wrote:
>> On 16.5.2012 10:36, zayatzz wrote:
>>
>>> /opt/bin/python^M: bad interpreter: No such file or directory
>> Your script has CRLF end-of-lines. Change it to plain Unix LF.
>>
>> Matěj
> Thanks :) but i have no idea what that means or how to achieve that.
>
> AlanSee in the echo of the shebang line the "^M" at the end ?  That's a
carriage return, hex(0d).  Unix/Linux use a single linefeed (hex(0a)) at
the end of the line.  At some point, you probably edited this file with
a Windows (aka DOS) editor, and it used the CRLF form (hex(0d0a)),
carriage return/line feed at the end of each line.

Your Linux text editor probably has a menu option to convert them back
to simple linefeeds, but if not, your Linux/Unix probably has a utility

    dos2unix

which can do the job.-- 

DaveA
Chris Angelico 1337159491Wed, 16 May 2012 09:11:31 +0000 (UTC)
On Wed, May 16, 2012 at 6:36 PM, zayatzz  wrote:
> There is one problem though...
>
> when i start script with shebang like
> #!/opt/bin/python
>
> and then try to run the script i get:
>
> /opt/bin/python^M: bad interpreter: No such file or directoryYou have a Windows end-of-line \r\n instead of a Unix end-of-line \n -
how are you editing the files? If nothing else, run the script through
dos2unix or equivalent before executing.

ChrisA
Stefan Behnel 1337158052Wed, 16 May 2012 08:47:32 +0000 (UTC)
zayatzz, 16.05.2012 10:22:> On May 15, 7:42 pm, Miki Tebeka wrote:
>>> Can someone point me towards a resource or two which will tell me how
>>> to do this - im not very good with whole linux/servers stuff. Im using
>>> ubuntu linux - if that makes any difference.
>>
>> Did not test, but this is the direction I would take:
>> * Download Python sources
>> * Open Terminal
>> * Run the following commands in the Terminal window
>>   - sudo apt-get build-dep python
>>   - tar -xjf Python-2.7.3.tar.bz2
>>   - cd Python-2.7.3
>>   - ./configure --prefix=/opt --enable-unicode=ucs2 && make
>>   - sudo make install
>> * Now you should have /opt/bin/python with ucs2
>>
>> HTH
>> --
>> Miki Tebeka http://pythonwise.blogspot.com
> 
> Thanks for reply :)
> 
> And it seems to work... When i type in
> /opt/bin/python
> import sys
> sys.maxunicode
> 
> then i get the desired answer - 65535
> 
> But it seems the work only begins now, because i cant use other python
> libraries now with this version of python and i probably have to
> install them all again somehow...You should install "distribute" and "pip" into it, then you can use pip to
install packages directly and automatically from the Python Package Index
(PyPI), including any dependencies.

Even better, use "virtualenv" to create a local copy of your installation
and then install packages into that. This allows you to use completely
separate environments of the same Python installation, which can be very
handy for testing.

Stefan
Home | About | Privacy